I'm trying to execute a request at another service that I own. The guides I'm using to create the app are:
QUARKUS - Using the REST Client
I'm getting an error like:
org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Error injecting com.easy.ecomm.core.product.ProductClient com.easy.ecomm.core.cart.CartService.productClient
org.eclipse.microprofile.rest.client.RestClientDefinitionException: Parameters and variables don't match on interface com.easy.ecomm.core.product.ProductClient::findProductById
Here's the class ProductClient
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@Path("products")
@RegisterRestClient(configKey = "products-api")
public interface ProductClient {
@GET
@Path("{id}")
Product findProductById(String id);
}
Here's the Service Layer:
import org.eclipse.microprofile.rest.client.inject.RestClient;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
@ApplicationScoped
public class CartService {
@Inject
@RestClient
ProductClient productClient;
public void addItem(String cartId, String productId, Integer amount){
// Code to find the cart on a queue.
Product product = findProduct(productId);
cart.getItems().add(new CartItem(amount, product));
}
private Product findProduct(String productId) {
return productClient.findProductById(productId);
}
}
and the application.properties:
products-api/mp-rest/url=http://localhost:8060
products-api/mp-rest/scope=javax.inject.Singleton
The dependencies are the same as we have on the guides quarkus-rest-client and quarkus-rest-client-jackson
Things that I've already tried:
Remove the ConfigKey from the @RegisterRestClient and use the full path on the application.properties, add the Jandex Plugin on my POM.xml as described here.
But still no success. Each change gives me the same error message.