Bean 'scopedTarget.oauth2ClientContext' could not be registered same bean name has already been defined in class path

bmalhi :

I am simple trying to enable google sign in feature for my app but getting this particular error. I don't understand this problem why I am getting it? I need help to fix this error? Any hints?

@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
Filip Wielkopolan :

I had encountered the same issue. I resolved it by upgrading the version of spring-security-oauth2-autoconfigure library to 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>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=84281&siteId=1