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

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


      org.springframework.boot
      spring-boot-autoconfigure
      provided

问题描述如下:

***************************
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();
    }
}

启动后,问题解决

你可能感兴趣的:(Spring,Boot,Spring,Security,spring,boot,spring,security,spring,security,oauth)