You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In versions before quarkus 2.4.0-final the configuration of MP REST clients was possible during the runtime of the application. It was very helpful e.g to switch an client to a backup system if the productive system was not available. since quarkus 2.4.0-final the mutation of the Microprofile Rest Client properties during the runtime does not have effect.
Example:
Resource:
@RequestScoped
@Path("/hello")
public class GreetingResource {
public static final String GREETING_MESSAGE = "Hello From GreetingResource";
public static final String CONFIG_NAME_SALUTATION = "greetings.salutation";
@ConfigProperty(name = CONFIG_NAME_SALUTATION, defaultValue = "Hoi!!")
String salutation;
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return salutation + " " + GREETING_MESSAGE;
}
}
Client:
@RequestScoped
@RegisterRestClient(configKey = "greetings.client")
public interface GreetingsClient {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello();
}
⚠️Test is failing since quarkus 2.4.0-final:
@QuarkusTest
public class GreetingResourceTest {
@Inject
@RestClient
GreetingsClient greetingsClient;
@Test
@SetSystemProperty(key = "greetings.client/mp-rest/url", value = "https://www.google.de")
public void testWithRestClientWithWrongUrl_ViaMP() {
String message = greetingsClient.hello();
assertThat(message, not(containsString(GreetingResource.GREETING_MESSAGE))); //⚠️failing since quarkus 2.4.0-final
}
}
Expected behavior
After the mutation of MP REST client configuration the newly created instance must use the changed configuration
Actual behavior
MP REST Client configuration at runtime does not work since quarkus 2.4.0-final
Is this related to the new rest client config stuff?
Yes.
The problem here is that since the Rest Client configuration is now handled by the RestClientsConfig ConfigRoot, this is only loaded at application start and any changes to the configuration have no further effects (like setting the system property in the test).
I think I'm going to open a separate issue to group all these problems so we don't have the discussion spread between several issues.
Describe the bug
In versions before quarkus 2.4.0-final the configuration of MP REST clients was possible during the runtime of the application. It was very helpful e.g to switch an client to a backup system if the productive system was not available. since quarkus 2.4.0-final the mutation of the Microprofile Rest Client properties during the runtime does not have effect.
Example:
Resource:
Client:
Expected behavior
After the mutation of MP REST client configuration the newly created instance must use the changed configuration
Actual behavior
MP REST Client configuration at runtime does not work since quarkus 2.4.0-final
How to Reproduce?
https://github.com/franden/issue-rest-client-configuration
run
GreetingResourceTest.testWithRestClientWithWrongUrl_ViaMP
testOutput of
uname -a
orver
Microsoft Windows [Version 10.0.19042.1288]
Output of
java -version
openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.4.1-final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: C:\Users\ivfrk.m2\wrapper\dists\apache-maven-3.8.1-bin\2l5mhf2pq2clrde7f7qp1rdt5m\apache-maven-3.8.1 Java version: 11.0.10, vendor: AdoptOpenJDK, runtime: c:\Work\Tools\JDK\11\OpenJDK11U-jdk_x64_windows_hotspot_11.0.10_9\jdk-11.0.10+9 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Additional information
No response
The text was updated successfully, but these errors were encountered: