Код: Выделить всё
: Unsatisfied dependency expressed through method 'webClient' parameter 0;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type
'org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository'
available: expected at least 1 bean which qualifies as autowire candidate.
Код: Выделить всё
spring.security.oauth2.client.registration.eipo.authorization-grant-type=client_credentials
spring.security.oauth2.client.registration.eipo.token-uri=https://devapi.somedomain.co.xx/v1/auth/token
spring.security.oauth2.client.registration.eipo.client-id=randomClientId
spring.security.oauth2.client.registration.eipo.client-secret=T#%*sty%xp4^sdxb(e*
spring.main.web-application-type= reactive
Код: Выделить всё
@Configuration
public class WebClientConfig {
@Bean
WebClient webClient(ReactiveClientRegistrationRepository clientRegistrations) {
ServerOAuth2AuthorizedClientExchangeFilterFunction oauth =
new ServerOAuth2AuthorizedClientExchangeFilterFunction(
clientRegistrations,
new UnAuthenticatedServerOAuth2AuthorizedClientRepository());
oauth.setDefaultClientRegistrationId("eipo");
return WebClient.builder()
.filter(oauth)
.build();
}
}
Код: Выделить всё
@Slf4j
@Service
public class SettlementService
@Autowired
private WebClient webClient;
public void getAuthThenGetResource(){
... //trying to get token
log.info("got token");
... //get something from external resource
log.info("got response");
}
}
Код: Выделить всё
org.springframework.boot
spring-boot-starter-parent
2.7.10
1.8
org.springframework.boot
spring-boot-starter-data-rest
org.springframework.boot
spring-boot-starter-web
org.springframework.data
spring-data-rest-hal-explorer
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-tomcat
provided
org.springframework.boot
spring-boot-starter-test
test
io.github.openfeign
feign-okhttp
10.11
io.github.openfeign
feign-gson
10.11
io.github.openfeign
feign-slf4j
10.11
com.playtika.reactivefeign
feign-reactor-jetty
3.1.1
io.swagger
swagger-annotations
1.5.20
jar
org.springframework.boot
spring-boot-starter-webflux
org.springframework.security
spring-security-oauth2-client
5.3.13.RELEASE
jar
org.springframework.boot
spring-boot-maven-plugin
org.projectlombok
lombok
Что не так с bean-компонентом веб-клиента? Я пробовал много решений, которые нашел в stackoverflow, но ни одно из них не сработало. Спасибо за помощь.
Подробнее здесь: https://stackoverflow.com/questions/759 ... -registrat