2016-10-05 2 views
0

웹 응용 프로그램에서 OAuth 인증을 설정하는 데이 tutorial을 따르려고합니다. 방금 시작했습니다. 저는 봄이 새롭고 내 머리가 왜 OAuth2AuthorisationServerConfig 클래스인지 긁어 왔습니다. 콩을 집어 올릴 수 없다. @Qualifier가 @Bean을 선택하지 않음

@Configuration 
public class ServerSecurityConfig extends WebSecurityConfigurerAdapter { 

    @Override 
    protected void configure(AuthenticationManagerBuilder auth) throws Exception { 
     auth.inMemoryAuthentication().withUser("JL").password("TEST").roles("USER"); 
    } 

    @Override 
    @Bean //Here is the bean 
    public AuthenticationManager authenticationManagerBean() throws Exception { 
     return super.authenticationManagerBean(); 
    } 

    @Override 
    protected void configure(HttpSecurity http) throws Exception { 
     http.authorizeRequests() 
       .antMatchers("/", "/login", "/register").permitAll() 
       .anyRequest().authenticated() 
       .and().formLogin().permitAll() 
       .and().logout().permitAll(); 
    } 

} 

@Configuration 
public class OAuth2AuthorisationServerConfig extends AuthorizationServerConfigurerAdapter { 

    @Autowired 
    @Qualifier("authenticationManagerBean") // here is the qualifier for bean 
    private AuthenticationManager authenticationManager; 
    .... 
} 

두 클래스

내가 @ComponentScan 함께 주석했던 OAuth2AuthorisationServerConfig 클래스에 같은 패키지

답변