ReactiveFeignClient error: Class has annotations [ReactiveFeignClient] that are not used by contract Default

Viewed 13

I am building a microservice which uses the Reactive Feign Client defined in another microservice in order to fetch some data. I added the configuration for the feign client, enabled reactive feign clients, but when I am running the program, I get:

"Class CurrencyServiceClient has annotations [ReactiveFeignClient] that are not used by contract Default" and "Method getCurrenciesDefinition has an annotation GetMapping that is not used by contract Default".

I am not sure what I did not configure right in my microservice. Below is my code:

  1. ReactiveFeignClient from currencies-service
@ReactiveFeignClient(
        configuration = CurrencyServiceInternalClientConfiguration.class,
        value = "currency-service",
        path = "/currency-service/internal"
)
public interface CurrencyServiceClient {

    @GetMapping(path = "/users/{userId}/balances/{currencyId}")
    Mono<CurrencyBalanceResponse> getUserBalance(@PathVariable("userId") String userId,
                                                 @PathVariable("currencyId") Long currencyId);

    @GetMapping(path = "/currencies")
    Mono<CurrenciesResponse> getCurrenciesDefinition(@RequestParam(value = "userId", required = false) Optional<String> userId); ```
  1. service where reactive feign client is used in the other microservice
@RequiredArgsConstructor
@Service
@Slf4j
public class CurrenciesService {

    private final CurrencyServiceClient currencyServiceClient;

    public CompletableFuture<CurrenciesResponse> getCurrencies() {
        List<Currency> currenciesList = new ArrayList<>();
        return currencyServiceClient.getCurrenciesDefinition(Optional.empty())
                .toFuture()
                .thenCompose(currenciesResponse -> {
                    currenciesResponse.getCurrencies().stream().forEach(currency -> {
                        Long currentTimestamp = Instant.now().getMillis();
                        if (currency.getResetTimestamp() <= currentTimestamp) {
                            currenciesList.add(Currency.builder().id(currency.getId())
                                    .name(currency.getName()).build());
                        }
                    });
                    return CompletableFuture.completedFuture(CurrenciesResponse.builder()
                            .status(ResponseStatus.SUCCESS)
                            .currencies(currenciesList)
                            .build());
                })
                .exceptionally(exception -> CurrenciesResponse.builder()
                        .status(ResponseStatus.ERROR)
                        .build());
    }
}
  1. configuration
@Configuration
@AutoConfigureAfter(ReactiveFeignAutoConfiguration.class)
@ConditionalOnProperty(prefix = "currency-service.client", name = "enabled", havingValue = "true",matchIfMissing = false)
@EnableReactiveFeignClients(clients = CurrencyServiceClient.class)
public class CurrencyClientAutoConfiguration {
}

  1. other properties
feign:
  hystrix:
    enabled: true
currency-service:
  client:
    enabled: true
eager-load:
    clients: currency-service
    enabled: true

Can anyone help?

0 Answers
Related