bma*_*lhi 3 java spring spring-security oauth-2.0 spring-boot
我很简单,尝试为我的应用启用google登录功能,但遇到此特定错误。我不明白为什么要得到这个问题?我需要帮助解决此错误吗?有什么提示吗?
@Configuration
@EnableOAuth2Sso
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf()
.disable()
.antMatcher("/**")
.authorizeRequests()
.antMatchers("/", "/welcomepage")
.permitAll()
.anyRequest()
.authenticated();
}
}
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'scopedTarget.oauth2ClientContext', defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration$SessionScopedConfiguration$ClientContextConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/security/oauth2/config/annotation/web/configuration/OAuth2ClientConfiguration$OAuth2ClientContextConfiguration.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
Run Code Online (Sandbox Code Playgroud)
小智 14
我遇到了同样的问题。我通过将spring-security-oauth2-autoconfigure库的版本升级到2.1.1.RELEASE来解决它。
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2779 次 |
| 最近记录: |