Closed. This question is opinion-based。它当前不接受答案。
                            
                        
                    
                
            
                    
                
                        
                            
                        
                    
                        
                            想改善这个问题吗?更新问题,以便editing this post用事实和引用来回答。
                        
                        22天前关闭。
                    
                
        

目前,我正在使用Spring Boot 2.2.5 Release。文档看起来不完整。什么是@EnableOAuth2Client@EnableOAuth2Sso的替代品。enter image description here

最佳答案

您可以通过WebSecurityConfigurerAdapter的configure方法(而不是注释)来执行此操作。


EnableOAuth2Sso现在是这样的:

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests()
     .anyRequest().authenticated()
     .and()
     .oauth2Login(); // sso
}

@ EnableOAuth2Client现在是这个(有关完整的示例和配置选项,请参见Spring's migration guide):

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

09-11 11:03