使用键设置Bean属性“sourceList”时,无法解析对Bean“org.springframework.security.web.DefaultSecurityFilterChain#31”的引用

yjghlzjz  于 2023-03-02  发布在  Spring
关注(0)|答案(1)|浏览(314)

最近,我已经从4.0.5.RELEASE升级到了Spring 5.3.20,我也改变了其他的依赖版本。它正在成功地构建,但是当我试图运行时,它在码头后给出了错误。
Pom. xml中的升级版本:

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java-version>1.8</java-version>
        <org.springframework-version>5.3.20</org.springframework-version>
        <org.springframework-security-version>5.6.3</org.springframework-security-version>
        <org.apache.tiles-version>3.0.4</org.apache.tiles-version>
        <!-- <org.hibernate-version>5.6.10.Final</org.hibernate-version> --> <!-- 4.3.5.Final -->
        <org.hibernate-version>5.3.7.Final</org.hibernate-version><!-- 5.1.17.Final -->
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.7.7</org.slf4j-version>
        <jackson.version>2.11.3</jackson.version>    <!-- 2.11.3 -->
        <!--  <jackson.version>2.14.1</jackson.version> -->
    </properties>

构建是成功的(使用maven),但当我尝试运行代码时,我在jetty之后得到这个错误,
错误-

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#31' while setting bean property 'sourceList' with key [31]; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#31': Cannot resolve reference to bean 'concurrencyFilter' while setting constructor argument with key [2]; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'concurrencyFilter' defined in ServletContext resource [/WEB-INF/spring/security.xml]: Instantiation of bean failed; 
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.web.session.ConcurrentSessionFilter]: No default constructor found; 
nested exception is java.lang.NoSuchMethodException: org.springframework.security.web.session.ConcurrentSessionFilter.<init>()

任何人都可以帮助我解决这个错误。将非常感谢任何帮助。

ajsxfq5m

ajsxfq5m1#

我有同样的错误与 Spring 6。一些布迪帮助我们找到正在发生的事情。

09:03:26,957 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "cediplan-1.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"cediplan-1.war\".undertow-deployment" => "java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]
    Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'org.springframework.security.web.access.intercept.AuthorizationFilter#0' while setting constructor argument with key [11]
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.access.intercept.AuthorizationFilter#0': Cannot resolve reference to bean 'org.springframework.security.config.http.AuthorizationFilterParser$RequestMatcherDelegatingAuthorizationManagerFactory#0' while setting constructor argument
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.http.AuthorizationFilterParser$RequestMatcherDelegatingAuthorizationManagerFactory#0': Cannot create inner bean '(inner bean)#5b71c55c' of type [org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher] while setting bean property 'requestMatcherMap'
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#5b71c55c': Cannot create inner bean '(inner bean)#51b9d134' of type [org.springframework.security.config.http.HandlerMappingIntrospectorFactoryBean] while setting constructor argument
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#51b9d134': FactoryBean threw exception on object creation
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'mvcHandlerMappingIntrospector' available: A Bean named mvcHandlerMappingIntrospector of type org.springframework.web.servlet.handler.HandlerMappingIntrospector is required to use MvcRequestMatcher. Please ensure Spring Security & Spring MVC are configured in a shared ApplicationContext."}}
09:03:26,983 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "cediplan-1.war" (runtime-name : "cediplan-1.war")
09:03:26,983 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."cediplan-1.war".undertow-deployment: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]
WFLYCTL0448: 1 additional services are down due to their dependencies being missing or failed

相关问题