【Spring Boot问题】--authenticationManager无法注入

版权声明:欢迎大家转载: https://blog.csdn.net/u012377333/article/details/84376251

在更换spring-boot-auto-config的版本从1.5.13升级至2.0.6的过程中出现问题

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-autoconfigure</artifactId>
      <scope>provided</scope>
</dependency>

问题描述如下:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field configurers in org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration.

在网上参考的做法:

authenticationManager无法注入问题

authenticationManager 无法注入解决办法

我自己的解决办法是,添加一下配置类WebSecurityConfig

/**
 * @Auther: chisj [email protected]
 * @Date: 2018-11-23 10:36
 * @Description:
 */
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Bean
    @Override
    public AuthenticationManager authenticationManagerBean() throws Exception {
        return super.authenticationManagerBean();
    }
}

启动后,问题解决

猜你喜欢

转载自blog.csdn.net/u012377333/article/details/84376251