zoukankan      html  css  js  c++  java
  • 执行顺序AuthorizationServerConfigurerAdapter->WebSecurityConfigurerAdapter导致AuthenticationManager依赖注入空指针(oauth2)

    oauth2的依赖版本:

    <dependency>  
           <groupId>org.springframework.security.oauth.boot</groupId>
           <artifactId>spring-security-oauth2-autoconfigure</artifactId>
           <version>2.1.2.RELEASE</version>
    </dependency>
    

      单独在启动引导类上import,指定加载顺序

    @SpringBootApplication
    @Import({WebSecurityConfigurer.class, AuthorizationServerConfigurer.class})
    public class SpringBootApplication {
    
        public static void main(String[] args) throws UnknownHostException {
             SpringApplication.run(SpringBootSecurityOauth2AuthApplication.class, args);
    }
    
    
    对应的认证服务器
    //@Configuration
    @EnableAuthorizationServer
    public class AuthorizationServerConfigurer extends AuthorizationServerConfigurerAdapter {
    ...
    }
    
    //@Configuration
    public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
        @Bean
        @Override
        public AuthenticationManager authenticationManagerBean() throws Exception {
            return super.authenticationManagerBean();
        }
    ...
    }
    

      

  • 相关阅读:
    关于选择器
    关于定位
    jq第一讲
    js第三讲
    js第2讲
    js第一讲
    HTML第三讲的补充及HTML5新增标签和属性
    CSS第 三讲概要
    CSS第二讲概要
    CSS第一讲概要
  • 原文地址:https://www.cnblogs.com/cmmplb/p/15245564.html
Copyright © 2011-2022 走看看