diff --git a/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java b/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java index 7eee1cf12d9bb..f88f7454cbf79 100644 --- a/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java +++ b/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java @@ -235,7 +235,7 @@ void registerProviders(BuildProducer reflectiveClass, CombinedIndexBuildItem combinedIndexBuildItem, SmallRyeRestClientTemplate smallRyeRestClientTemplate) { smallRyeRestClientTemplate.initializeResteasyProviderFactory(jaxrsProvidersToRegisterBuildItem.useBuiltIn(), - jaxrsProvidersToRegisterBuildItem.getProviders()); + jaxrsProvidersToRegisterBuildItem.getProviders(), jaxrsProvidersToRegisterBuildItem.getContributedProviders()); // register the providers for reflection for (String providerToRegister : jaxrsProvidersToRegisterBuildItem.getProviders()) { diff --git a/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java b/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java index 0597b2fe58ae0..422d03fab6d63 100644 --- a/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java +++ b/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java @@ -39,7 +39,8 @@ public void setSslEnabled(boolean sslEnabled) { RestClientBuilderImpl.SSL_ENABLED = sslEnabled; } - public void initializeResteasyProviderFactory(boolean useBuiltIn, Set providersToRegister) { + public void initializeResteasyProviderFactory(boolean useBuiltIn, Set providersToRegister, + Set contributedProviders) { ResteasyProviderFactory clientProviderFactory = new ResteasyProviderFactoryImpl(null, true) { @Override public RuntimeType getRuntimeType() { @@ -55,8 +56,15 @@ protected void initializeUtils() { if (useBuiltIn) { RegisterBuiltin.register(clientProviderFactory); + registerProviders(clientProviderFactory, contributedProviders); + } else { + registerProviders(clientProviderFactory, providersToRegister); } + RestClientBuilderImpl.PROVIDER_FACTORY = clientProviderFactory; + } + + private static void registerProviders(ResteasyProviderFactory clientProviderFactory, Set providersToRegister) { for (String providerToRegister : providersToRegister) { try { clientProviderFactory @@ -65,7 +73,5 @@ protected void initializeUtils() { throw new RuntimeException("Unable to find class for provider " + providerToRegister, e); } } - - RestClientBuilderImpl.PROVIDER_FACTORY = clientProviderFactory; } }