In oauth2 client , it's showing error for not able to resolve OAuth2ClientContext injection in the following code. Error: 'Could not autowire. There is more than one bean of OAuth2ClientContext Type'. Any solution?
@Bean
public OAuth2RestOperations restTemplate(OAuth2ClientContext oauth2ClientContext) {
return new OAuth2RestTemplate(resource(), oauth2ClientContext);
}
Try first to autowire using the qualifier as follows
@Autowired
@qualifier("oauth2ClientContext")
OAuth2ClientContext oAuth2ClientContext;
A very strange thing. I hope this will be fixed.
Kotlin:
@Autowired @Qualifier("oauth2ClientContext") private val oauth2ClientContext: OAuth2ClientContext
Most helpful comment
Try first to autowire using the qualifier as follows
@Autowired
@qualifier("oauth2ClientContext")
OAuth2ClientContext oAuth2ClientContext;