我只是将以下依赖项添加到我的Spring Boot 1.4应用程序中:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
<version>1.3.3.RELEASE</version>
</dependency>
为了将Spring Cloud Config Server用作外部配置服务器。
当我启动应用程序时,我现在收到此错误:
Caused by: java.lang.IllegalStateException: At least one SecurityBuilder<? extends SecurityFilterChain> needs to be specified. Typically this done by adding a @Configuration that extends WebSecurityConfigurerAdapter. More advanced users can invoke WebSecurity.addSecurityFilterChainBuilder directly
at org.springframework.util.Assert.state(Assert.java:392)
at org.springframework.security.config.annotation.web.builders.WebSecurity.performBuild(WebSecurity.java:276)
at org.springframework.security.config.annotation.web.builders.WebSecurity.performBuild(WebSecurity.java:75)
at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:334)
at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41)
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:104)
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$fc86a60e.CGLIB$springSecurityFilterChain$5(<generated>)
at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration$$EnhancerBySpringCGLIB$$fc86a60e$$FastClassBySpringCGLIB$$a1dd410.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
我已经有了一个现有的安全配置,但这扩展了不同的东西:
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends GlobalMethodSecurityConfiguration
有没有人对此有任何想法?我想也许我的依赖导致升级可能是Spring Security的一部分,现在需要以不同的方式进行配置?
答案 0 :(得分:0)
这是由于未创建以下bean导致的,因为将spring cloud依赖关系set management.security.default添加到false,从而禁止创建此bean。
#!/usr/bin/env python
# -*- coding: utf-8 -*