Skip to content

Commit

Permalink
Merge pull request #43774 from radcortez/fix-43748
Browse files Browse the repository at this point in the history
Move RestClientReactiveConfig to use @ConfigMapping
  • Loading branch information
gsmet authored Oct 9, 2024
2 parents 23feeae + 16ea69f commit dfcf848
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
7 changes: 5 additions & 2 deletions docs/src/main/asciidoc/rest-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2029,8 +2029,11 @@ To change this behavior, set the `quarkus.rest-client-reactive.scope` property t
- it is not possible to set `HostnameVerifier` or `SSLContext`
- a few things that don't make sense for a non-blocking implementations, such as setting the `ExecutorService`, don't work



== Further reading

* link:https://download.eclipse.org/microprofile/microprofile-rest-client-2.0/microprofile-rest-client-spec-2.0.html[MicroProfile Rest Client specification]

== Configuration Reference

include::{generated-dir}/config/quarkus-rest-client_quarkus.rest-client.adoc[opts=optional, leveloffset=+1]
include::{generated-dir}/config/quarkus-rest-client-config.adoc[opts=optional, leveloffset=+1]
4 changes: 4 additions & 0 deletions docs/src/main/asciidoc/resteasy-client.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -670,3 +670,7 @@ describes how to set it up in detail.
== Further reading

* link:https://download.eclipse.org/microprofile/microprofile-rest-client-2.0/microprofile-rest-client-spec-2.0.html[MicroProfile Rest Client specification]

== Configuration Reference

include::{generated-dir}/config/quarkus-rest-client-config.adoc[opts=optional, leveloffset=+1]
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void setUpDefaultMediaType(BuildProducer<RestClientDefaultConsumesBuildItem> con
RestClientReactiveConfig config) {
consumes.produce(new RestClientDefaultConsumesBuildItem(MediaType.APPLICATION_JSON, 10));
produces.produce(new RestClientDefaultProducesBuildItem(MediaType.APPLICATION_JSON, 10));
if (config.disableSmartProduces) {
if (config.disableSmartProduces()) {
disableSmartProduces.produce(new RestClientDisableSmartDefaultProduces());
}
}
Expand Down Expand Up @@ -286,7 +286,7 @@ void registerProvidersFromAnnotations(CombinedIndexBuildItem indexBuildItem,
constructor.invokeSpecialMethod(MethodDescriptor.ofConstructor(AnnotationRegisteredProviders.class),
constructor.getThis());

if (clientConfig.providerAutodiscovery) {
if (clientConfig.providerAutodiscovery()) {
for (AnnotationInstance instance : index.getAnnotations(ResteasyReactiveDotNames.PROVIDER)) {
ClassInfo providerClass = instance.target().asClass();

Expand Down
3 changes: 0 additions & 3 deletions extensions/resteasy-reactive/rest-client/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-AlegacyConfigRoot=true</arg>
</compilerArgs>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
package io.quarkus.rest.client.reactive.runtime;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import io.smallrye.config.WithName;

/**
* Build time REST client config.
*/
@ConfigRoot(name = "rest-client", phase = ConfigPhase.BUILD_TIME)
public class RestClientReactiveConfig {
@ConfigMapping(prefix = "quarkus.rest-client")
@ConfigRoot(phase = ConfigPhase.BUILD_TIME)
public interface RestClientReactiveConfig {

/**
* By default, RESTEasy Reactive uses text/plain content type for String values
* and application/json for everything else.
*
* <p>
* MicroProfile Rest Client spec requires the implementations to always default to application/json.
* This build item disables the "smart" behavior of RESTEasy Reactive to comply to the spec
*/
@Deprecated // Deprecated in favour of RestClientsConfig.disableSmartProduces
@ConfigItem(name = "disable-smart-produces", defaultValue = "false")
public boolean disableSmartProduces;
@WithName("disable-smart-produces")
@WithDefault("false")
boolean disableSmartProduces();

/**
* Whether providers (filters, etc.) annotated with {@link jakarta.ws.rs.ext.Provider} should be
* automatically registered for all the clients in the application.
*/
@ConfigItem(name = "provider-autodiscovery", defaultValue = "true")
public boolean providerAutodiscovery = true;
@WithName("provider-autodiscovery")
@WithDefault("true")
boolean providerAutodiscovery();
}

0 comments on commit dfcf848

Please sign in to comment.