Java 组件需要找不到ObjectPostProcessor类型的bean
我已经在我的spring boot应用程序中配置了oauth,当我尝试运行我的project main类应用程序时,无法开始声明:Java 组件需要找不到ObjectPostProcessor类型的bean,java,spring-mvc,oauth-2.0,Java,Spring Mvc,Oauth 2.0,我已经在我的spring boot应用程序中配置了oauth,当我尝试运行我的project main类应用程序时,无法开始声明: 'A component required a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' that could not be found. 我参考了一些类似的堆栈溢出问题和答案,但仍然没有找到任何解决方案 这是我添加的WebSecurityCo
'A component required a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' that could not be found.
我参考了一些类似的堆栈溢出问题和答案,但仍然没有找到任何解决方案
这是我添加的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();
}
}
这些是我的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>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.0.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-security</artifactId>
<version>1.1.3.RELEASE</version>
</dependency>
</dependencies>
}
当我尝试运行main类时,会出现以下错误:
说明:
A component required a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' that could not be found.
行动:
Consider defining a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' in your configuration.
您能提供其他相关答案的链接吗?请检查此链接
Consider defining a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' in your configuration.