Repository: quarkusio/quarkus
Issue: SmallRye REST client - warnings about duplicate provider registration

When I add the `quarkus-smallrye-rest-client` extension to my app I get a bunch of warnings:
```
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.IIOImageProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.sse.SseEventOutputProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.sse.SseEventProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DefaultTextPlain is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.client.jaxrs.internal.CompletionStageRxInvokerProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.ReactiveStreamProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.interceptors.CacheControlFeature is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.interceptors.ServerContentEncodingAnnotationFeature is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.FormUrlEncodedProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.CompletionStageProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.interceptors.ClientContentEncodingAnnotationFeature is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DefaultNumberWriter is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.SourceProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.FileProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.context.ContextFeature is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.interceptors.MessageSanitizerContainerResponseFilter is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.MultiValuedParamConverterProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DocumentProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DefaultBooleanWriter is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.ByteArrayProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.StringTextStar is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.StreamingOutputProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.ReaderProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.sse.SseEventSinkInterceptor is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DataSourceProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,738 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.JaxrsFormProvider is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,739 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.FileRangeWriter is already registered.  2nd registration is being ignored.
2019-05-30 09:02:41,739 WARN  [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.InputStreamProvider is already registered.  2nd registration is being ignored.
```

Changed files:
extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java
extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java

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 7eee1cf12d9..f88f7454cbf 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<ReflectiveClassBuildItem> 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 0597b2fe58a..422d03fab6d 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<String> providersToRegister) {
+    public void initializeResteasyProviderFactory(boolean useBuiltIn, Set<String> providersToRegister,
+            Set<String> 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<String> 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;
     }
 }