我已经在 Spring Boot 应用程序中配置了 oauth 并且当我尝试运行我的项目主类应用程序时无法开始说明:
'A component required a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' that could not be found.
Run Code Online (Sandbox Code Playgroud)
我已经提到了几个类似的 Stack Overflow 问题和答案,但仍然没有找到任何解决方案。
这是WebSecurityConfiguration我添加的类:
@EnableOAuth2Sso
@Configuration
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter{
@Override
protected void configure(HttpSecurity http) throws Exception
{
http
.csrf()
.disable()
.antMatcher("/**")
.authorizeRequests()
.antMatchers("/", "/index.html")
.permitAll()
.anyRequest()
.authenticated();
}
}
Run Code Online (Sandbox Code Playgroud)
这些是我的pom.xml依赖项:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>1.4.1.RELEASE</version>
</dependency> …Run Code Online (Sandbox Code Playgroud)