gpt4 book ai didi

xml - 无法解析匹配的构造函数(提示 : specify index/type/name arguments for simple parameters to avoid type ambiguities)

转载 作者:数据小太阳 更新时间:2023-10-29 01:58:54 26 4
gpt4 key购买 nike

我在将 Spring 安全版本 3 迁移到 4 时遇到此异常。我正在使用基于 Sprig 4 XML 的安全性来实现它。您将不胜感激

异常:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'util:list#f1d6071': Cannot create inner bean 'security:filter-chain#1c5c0deb' of type [org.springframework.security.web.DefaultSecurityFilterChain] while setting bean property 'sourceList' with key [10]; nested exception is org.springframework.beans.factory.Bea nCreationException: Error creating bean with name 'security:filter-chain#1c5c0deb': Cannot resolve reference to bean 'adminConsoleDeniedExceptionTranslationFilter' while setting co nstructor argument with key [5]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminConsoleDeniedExceptionTranslationF ilter' defined in ServletContext resource [/WEB-INF/spring-security.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to a void type ambiguities)

在 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE] 在 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE]

spring-security.xml(受影响的 Spring 4 XML 配置的一小部分)

<bean id="filterChainProxy" class="org.springframework.security.web.FilterChainProxy">
<constructor-arg>
<util:list>
<security:filter-chain pattern="/refreshCache**" filters="scpf,noFilter,logoutFilter"/>
<security:filter-chain pattern="/admin/adminConsole/**" filters="scpf,dsToSpringFilter,securityFilter,logoutFilter,
fsi,adminConsoleDeniedExceptionTranslationFilter,adminConsoleFilter"/>
</util:list>
</constructor-arg>
</bean><bean id="etf"
class="org.springframework.security.web.access.ExceptionTranslationFilter">
<constructor-arg name="authenticationEntryPoint" ref="preAuthenticatedProcessingFilterEntryPoint"/>
</bean><bean id="adminConsoleDeniedExceptionTranslationFilter" class="org.springframework.security.web.access.ExceptionTranslationFilter">
<constructor-arg name="authenticationEntryPoint2" ref="preAuthenticatedProcessingFilterEntryPoint"/>
<constructor-arg ref="adminConsoleAccessDeniedHandler"/></bean><bean id="preAuthenticatedProcessingFilterEntryPoint" class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint"/><bean id="adminConsoleAccessDeniedHandler" class="org.springframework.security.web.access.AccessDeniedHandlerImpl"><property name="errorPage" value="/WEB-INF/jsp/adminConsoleAccessDenied.jsp"/></bean>

最佳答案

第一个构造函数参数中的名称属性(bean adminConsoleDeniedExceptionTranslationFilter)具有奇怪的值authenticationEntryPoint2:

<bean id="adminConsoleDeniedExceptionTranslationFilter" class="org.springframework.security.web.access.ExceptionTranslationFilter">
<constructor-arg name="authenticationEntryPoint2" ref="preAuthenticatedProcessingFilterEntryPoint"/>
<constructor-arg ref="adminConsoleAccessDeniedHandler"/>
</bean>

根据documentation应该是authenticationEntryPoint .

另外,第二个构造函数参数没有 name 属性。考虑添加 name 属性,或同时删除这两个属性。

关于xml - 无法解析匹配的构造函数(提示 : specify index/type/name arguments for simple parameters to avoid type ambiguities),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32617310/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com