org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration

时间:2018-01-17 08:48:34

标签: spring spring-boot

我们一直在使用带有spring security 4.1.0.RELEASE版本的spring boot 1.4.7.RELEASE版本非常成功,最近我们想要将启动安全版本升级到1.5.9,捆绑的版本是4.2.3,但我们在启动项目时,通过命令行以及tomcat面临此异常。任何有关这方面的帮助将不胜感激。

我已经尝试在堆栈溢出和Github问题数据库中搜索类似的问题而没有太大的成功。

  

org.springframework.beans.factory.BeanCreationException:创建bean时出错?>名称为' springSecurityFilterChain'在> org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration中定义:通过工厂方法的Bean实例化失败;嵌套异常是> org.springframework.beans.BeanInstantiationException:无法实例化[javax.servlet.Filter]:工厂方法' s   pringSecurityFilterChain'抛出异常;嵌套异常是java.lang.NoSuchMethodError:org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration.getIgnored(Lorg / springfra   mework /引导/自动配置/安全/ SecurityProperties;)Ljava / util的/列表;       在org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RE   租]       在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:306)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)〜[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)〜[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)〜[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]       在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]       在org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]       在org.springframework.boot.SpringApplication.run(SpringApplication.java:303)[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]       在org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]       在org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]       在com.AuthApplication.main(AuthApplication.java:29)[classes /:na]   引起:org.springframework.beans.BeanInstantiationException:无法实例化[javax.servlet.Filter]:工厂方法' springSecurityFilterChain'抛出异常;嵌套异常是java.lang   .NoSuchMethodError:org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration.getIgnored(Lorg / springframework / boot / autoconfigure / security / SecurityProperties;)Ljava / util / List;       在org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       ...省略了20个常见帧   引起:java.lang.NoSuchMethodError:org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration.getIgnored(Lorg / springframework / boot / autoconfigure / security / SecurityPropertie   秒;)Ljava / util的/列表;       at org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration $ IgnoredPathsWebSecurityConfigurerAdapter.init(ManagementWebSecurityAutoConfiguration.java:160)〜[spring-boot-a   ctuator-1.3.3.RELEASE.jar:1.3.3.RELEASE]       在org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration $ IgnoredPathsWebSecurityConfigurerAdapter.init(ManagementWebSecurityAutoConfiguration.java:128)~ [spring-boot-a   ctuator-1.3.3.RELEASE.jar:1.3.3.RELEASE]       在org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.init(AbstractConfiguredSecurityBuilder.java:371)〜[spring-security-config-4.2.3.RELEASE.jar:4.2.3.RELEASE]       在org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:325)〜[spring-security-config-4.2.3.RELEASE.jar:4.2.3.RELEASE]       在org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41)〜[spring-security-config-4.2.3.RELEASE.jar:4.2.3.RELEASE]       在org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:104)〜[spring-security-config-4.2.3.RELEASE.jar:4。   2.3.RELEASE]       在org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration $$ EnhancerBySpringCGLIB $$ 26dd16a8.CGLIB $ springSecurityFilterChain $ 4()〜[spring-security-config-4   .2.3.RELEASE.jar:4.2.3.RELEASE]       at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration $$ EnhancerBySpringCGLIB $$ 26dd16a8 $$ FastClassBySpringCGLIB $$ f16ff4cb.invoke()〜[spring-security-c   onfig-4.2.3.RELEASE.jar:4.2.3.RELEASE]       在org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)~ [spring-core-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.context.annotation.ConfigurationClassEnhancer $ BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)〜[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]       在org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration $$ EnhancerBySpringCGLIB $$ 26dd16a8.springSecurityFilterChain()〜[spring-security-config-4.2.3.REL   EASE.jar:4.2.3.RELEASE]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[na:1.8.0_102]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[na:1.8.0_102]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[na:1.8.0_102]       在java.lang.reflect.Method.invoke(Method.java:498)〜[na:1.8.0_102]       在org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)〜[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]       ...省略了21个常见帧

 [INFO] +- org.owasp.encoder:encoder:jar:1.1.1:compile
 [INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile
 [INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
 [INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile
 [INFO] +- org.apache.commons:commons-lang3:jar:3.2.1:compile
 [INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:1.5.9.RELEASE:compile
 [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.9.RELEASE:compile
 [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.9.RELEASE:compile
 [INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.11:compile
 [INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.11:compile
 [INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
 [INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
 [INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
 [INFO] |  +- org.thymeleaf:thymeleaf-spring4:jar:2.1.6.RELEASE:compile
 [INFO] |  \- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:1.4.0:compile
 [INFO] |     \- org.codehaus.groovy:groovy:jar:2.4.13:compile
 [INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.5.9.RELEASE:compile
 [INFO] |  +- org.springframework:spring-aop:jar:4.3.13.RELEASE:compile
 [INFO] |  \- org.springframework.security:spring-security-config:jar:4.2.3.RELEASE:compile
 [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.9.RELEASE:compile
 [INFO] |  +- org.hibernate:hibernate-validator:jar:5.3.6.Final:compile
 [INFO] |  |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
 [INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
 [INFO] |  |  \- com.fasterxml:classmate:jar:1.3.4:compile
 [INFO] |  +- org.springframework:spring-web:jar:4.3.13.RELEASE:compile
 [INFO] |  \- org.springframework:spring-webmvc:jar:4.3.13.RELEASE:compile
 [INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.9.RELEASE:compile
 [INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.23:compile
 [INFO] |  |  \- org.apache.tomcat:tomcat-annotations-api:jar:8.5.23:compile
 [INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.23:compile
 [INFO] |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.23:compile
 [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.9.RELEASE:test
 [INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.5.9.RELEASE:test
 [INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.9.RELEASE:test
 [INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test
 [INFO] |  |  \- net.minidev:json-smart:jar:2.2.1:test
 [INFO] |  |     \- net.minidev:accessors-smart:jar:1.1:test
 [INFO] |  |        \- org.ow2.asm:asm:jar:5.0.3:test
 [INFO] |  +- org.assertj:assertj-core:jar:2.6.0:test
 [INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
 [INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
 [INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
 [INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
 [INFO] |  +- org.skyscreamer:jsonassert:jar:1.4.0:test
 [INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
 [INFO] |  +- org.springframework:spring-core:jar:4.3.13.RELEASE:compile
 [INFO] |  \- org.springframework:spring-test:jar:4.3.13.RELEASE:test
 [INFO] +- org.springframework.boot:spring-boot-starter-web-services:jar:1.5.9.RELEASE:compile
 [INFO] |  +- org.springframework:spring-oxm:jar:4.3.13.RELEASE:compile
 [INFO] |  \- org.springframework.ws:spring-ws-core:jar:2.4.2.RELEASE:compile
 [INFO] |     \- org.springframework.ws:spring-xml:jar:2.4.2.RELEASE:compile
 [INFO] +- org.springframework.security:spring-security-core:jar:4.2.3.RELEASE:compile
 [INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
 [INFO] |  +- org.springframework:spring-beans:jar:4.3.13.RELEASE:compile
 [INFO] |  +- org.springframework:spring-context:jar:4.3.13.RELEASE:compile
 [INFO] |  \- org.springframework:spring-expression:jar:4.3.13.RELEASE:compile
 [INFO] +- org.springframework.security:spring-security-web:jar:4.2.3.RELEASE:compile
 [INFO] +- org.springframework.security:spring-security-test:jar:4.2.3.RELEASE:test
 [INFO] +- org.springframework.security:spring-security-taglibs:jar:4.2.3.RELEASE:compile
 [INFO] |  \- org.springframework.security:spring-security-acl:jar:4.2.3.RELEASE:compile
 [INFO] |     \- org.springframework:spring-jdbc:jar:4.3.13.RELEASE:compile
 [INFO] +- org.springframework.data:spring-data-redis:jar:1.8.9.RELEASE:compile
 [INFO] |  +- org.springframework.data:spring-data-keyvalue:jar:1.2.9.RELEASE:compile
 [INFO] |  |  \- org.springframework.data:spring-data-commons:jar:1.13.9.RELEASE:compile
 [INFO] |  +- org.springframework:spring-tx:jar:4.3.13.RELEASE:compile
 [INFO] |  +- org.slf4j:slf4j-api:jar:1.7.25:compile
 [INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
 [INFO] +- com.rabbitmq:amqp-client:jar:3.4.4:compile
 [INFO] +- org.zeromq:jeromq:jar:0.3.5:compile
 [INFO] +- commons-cli:commons-cli:jar:1.1:compile
 [INFO] +- commons-codec:commons-codec:jar:1.9:compile
 [INFO] +- commons-io:commons-io:jar:1.2:compile
 [INFO] +- com.omne:omnesys:jar:1.18.0.0:compile
 [INFO] +- org.apache.logging.log4j:log4j-api:jar:2.7:compile
 [INFO] +- org.apache.logging.log4j:log4j-core:jar:2.7:compile
 [INFO] +- org.apache.logging.log4j:log4j-1.2-api:jar:2.3:compile
 [INFO] +- com.lmax:disruptor:jar:3.3.0:compile
 [INFO] +- commons-configuration:commons-configuration:jar:1.10:compile
 [INFO] |  +- commons-lang:commons-lang:jar:2.6:compile
 [INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
 [INFO] +- commons-collections:commons-collections:jar:3.2.2:compile
 [INFO] +- junit:junit:jar:4.12:test
 [INFO] +- net.sourceforge.nekohtml:nekohtml:jar:1.9.15:compile
 [INFO] |  \- xerces:xercesImpl:jar:2.9.1:compile
 [INFO] +- bsf:bsf:jar:2.4.0:compile
 [INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity3:jar:2.1.2.RELEASE:compile
 [INFO] |  \- org.thymeleaf:thymeleaf:jar:2.1.6.RELEASE:compile
 [INFO] |     +- ognl:ognl:jar:3.0.8:compile
 [INFO] |     +- org.javassist:javassist:jar:3.21.0-GA:compile
 [INFO] |     \- org.unbescape:unbescape:jar:1.1.0.RELEASE:compile
 [INFO] +- net.sf.ehcache:ehcache:jar:2.9.0:compile
 [INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
 [INFO] +- org.springframework:spring-context-support:jar:4.1.7.RELEASE:compile
 [INFO] +- org.json:json:jar:20151123:compile
 [INFO] +- org.bouncycastle:bcprov-jdk15on:jar:1.52:compile
 [INFO] +- org.bouncycastle:bcpkix-jdk15on:jar:1.52:compile
 [INFO] +- xalan:xalan:jar:2.7.1:compile
 [INFO] |  \- xalan:serializer:jar:2.7.1:compile
 [INFO] |     \- xml-apis:xml-apis:jar:1.4.01:compile
 [INFO] +- org.springframework.boot:spring-boot-starter-integration:jar:1.5.9.RELEASE:compile
 [INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.9.RELEASE:compile
 [INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.9:compile
 [INFO] |  +- org.springframework.integration:spring-integration-core:jar:4.3.12.RELEASE:compile
 [INFO] |  |  \- org.springframework.retry:spring-retry:jar:1.2.1.RELEASE:compile
 [INFO] |  \- org.springframework.integration:spring-integration-java-dsl:jar:1.2.3.RELEASE:compile
 [INFO] |     \- org.reactivestreams:reactive-streams:jar:1.0.0:compile
 [INFO] +- com.google.code.gson:gson:jar:2.8.2:compile
 [INFO] +- com.google.inject:guice:jar:2.0:compile
 [INFO] +- org.springframework.boot:spring-boot-starter-websocket:jar:1.5.9.RELEASE:compile
 [INFO] |  +- org.springframework:spring-messaging:jar:4.3.13.RELEASE:compile
 [INFO] |  \- org.springframework:spring-websocket:jar:4.3.13.RELEASE:compile
 [INFO] +- org.springframework.boot:spring-boot-starter-freemarker:jar:1.5.9.RELEASE:compile
 [INFO] |  \- org.freemarker:freemarker:jar:2.3.27-incubating:compile
 [INFO] +- ant-contrib:ant-contrib:jar:1.0b3:compile
 [INFO] +- org.apache.ant:ant-nodeps:jar:1.8.1:compile
 [INFO] |  \- org.apache.ant:ant:jar:1.8.1:compile
 [INFO] |     \- org.apache.ant:ant-launcher:jar:1.8.1:compile
 [INFO] +- ant:ant-commons-net:jar:1.6.5:compile
 [INFO] +- commons-net:commons-net:jar:1.4.1:compile
 [INFO] |  \- oro:oro:jar:2.0.8:compile
 [INFO] +- org.springframework.boot:spring-boot-actuator:jar:1.3.3.RELEASE:compile
 [INFO] |  +- org.springframework.boot:spring-boot:jar:1.5.9.RELEASE:compile
 [INFO] |  \- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.9.RELEASE:compile
 [INFO] +- com.sun.jersey:jersey-client:jar:1.19.3:compile
 [INFO] |  \- com.sun.jersey:jersey-core:jar:1.19.3:compile
 [INFO] |     \- javax.ws.rs:jsr311-api:jar:1.1.1:compile
 [INFO] +- org.apache.httpcomponents:httpclient:jar:4.3.6:compile
 [INFO] |  \- org.apache.httpcomponents:httpcore:jar:4.4.8:compile
 [INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
 [INFO] |  \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
 [INFO] +- org.springframework.session:spring-session:jar:1.3.1.RELEASE:compile
 [INFO] +- org.apache.commons:commons-pool2:jar:2.4.2:compile
 [INFO] \- redis.clients:jedis:jar:2.9.0:compile

1 个答案:

答案 0 :(得分:3)

由于这种依赖性:org.springframework.boot:spring-boot-actuator:jar:1.3.3.RELE‌​ASEManagementWebSecurityAutoConfiguration类使用旧版SpringBootWebSecurityConfiguration,调用getIgnored中不存在的静态方法org.springframework.boot:spring-boot-autoconfigure:jar:1.5.9‌​.RELEASE。将此依赖关系更新为org.springframework.boot:spring-boot-actuator:jar:1.5.9.RELE‌​‌​ASE可以解决您的问题