Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move RestClientReactiveConfig to use @ConfigMapping #43774

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
- 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

Check warning on line 2036 in docs/src/main/asciidoc/rest-client.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.Headings] Use sentence-style capitalization in 'Configuration Reference'. Raw Output: {"message": "[Quarkus.Headings] Use sentence-style capitalization in 'Configuration Reference'.", "location": {"path": "docs/src/main/asciidoc/rest-client.adoc", "range": {"start": {"line": 2036, "column": 4}}}, "severity": "INFO"}

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 @@
== 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

Check warning on line 674 in docs/src/main/asciidoc/resteasy-client.adoc

View workflow job for this annotation

GitHub Actions / Linting with Vale

[vale] reported by reviewdog 🐶 [Quarkus.Headings] Use sentence-style capitalization in 'Configuration Reference'. Raw Output: {"message": "[Quarkus.Headings] Use sentence-style capitalization in 'Configuration Reference'.", "location": {"path": "docs/src/main/asciidoc/resteasy-client.adoc", "range": {"start": {"line": 674, "column": 4}}}, "severity": "INFO"}

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();
}
Loading