Java 至少一个非空i。。。。。在使用@EnableWebSecurity时作为@Bean。提示尝试扩展WebSecurity配置适配器
这是我花了几个小时试图解决的问题后无法解决的问题。我正在研究使用java配置的spring安全性。我想出了以下例外,但不知道我应该做什么Java 至少一个非空i。。。。。在使用@EnableWebSecurity时作为@Bean。提示尝试扩展WebSecurity配置适配器,java,spring-mvc,spring-security,Java,Spring Mvc,Spring Security,这是我花了几个小时试图解决的问题后无法解决的问题。我正在研究使用java配置的spring安全性。我想出了以下例外,但不知道我应该做什么 Oct 22, 2015 6:00:57 AM org.apache.catalina.core.ApplicationContext log SEVERE: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error creating b
Oct 22, 2015 6:00:57 AM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.servlet.Filter org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain() throws java.lang.Exception] threw exception; nested exception is java.lang.IllegalStateException: At least one non-null instance of WebSecurityConfigurer must be exposed as a @Bean when using @EnableWebSecurity. Hint try extending WebSecurityConfigurerAdapter
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public javax.servlet.Filter org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain() throws java.lang.Exception] threw exception; nested exception is java.lang.IllegalStateException: At least one non-null instance of WebSecurityConfigurer must be exposed as a @Bean when using @EnableWebSecurity. Hint try extending WebSecurityConfigurerAdapter
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:188)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:586)
... 33 more
Caused by: java.lang.IllegalStateException: At least one non-null instance of WebSecurityConfigurer must be exposed as a @Bean when using @EnableWebSecurity. Hint try extending WebSecurityConfigurerAdapter
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:90)
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$1c09b217.CGLIB$springSecurityFilterChain$1(<generated>)
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$1c09b217$$FastClassBySpringCGLIB$$7b0370bc.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
我也有同样的问题,刚读完这篇文章,我就找到了答案:在stacktrace中:如果你走到消息的末尾,你可以找到:
Hint try extending WebSecurityConfigurerAdapter
所以我找到了我的webSecurityConfig类并添加了
extends WebSecurityConfigurerAdapter
我的服务器正确启动了我也遇到了同样的问题,刚读完这篇文章,我就找到了答案:它在stacktrace中:如果你走到消息的末尾,你可以找到:
Hint try extending WebSecurityConfigurerAdapter
所以我找到了我的webSecurityConfig类并添加了
extends WebSecurityConfigurerAdapter
我的服务器启动正常