一个组件需要一个无法找到的“org.springframework.security.config.annotation.ObjectPostProcessor”类型的bean

时间:2021-05-28 10:39:56

标签: java spring spring-boot spring-security

我在 spring boot 中编写应用程序,在添加 spring boot security 后,我遇到了编译问题。有人可以帮助我吗,或者以前有人遇到过这样的问题吗?

问题:

Description:

A component required a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' that could not be found.

Action:

Consider defining a bean of type 'org.springframework.security.config.annotation.ObjectPostProcessor' in your configuration.

代码

@Configuration
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {

    private UserService userService;

    public WebSecurityConfiguration(UserService userService) {
        this.userService = userService;
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(userService);
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        super.configure(http);
    }
}

感谢您的帮助!

0 个答案:

没有答案