Skip to content

Commit

Permalink
Register for reflection ConfigMappings implementation methods
Browse files Browse the repository at this point in the history
(cherry picked from commit 4d47192)
  • Loading branch information
radcortez authored and gsmet committed Dec 23, 2021
1 parent 661695b commit 1b97bab
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public static void generateConfigClasses(
reflectiveClasses
.produce(ReflectiveClassBuildItem.builder(mappingMetadata.getInterfaceType()).methods(true).build());
reflectiveClasses
.produce(ReflectiveClassBuildItem.builder(mappingMetadata.getClassName()).constructors(true).build());
.produce(ReflectiveClassBuildItem.builder(mappingMetadata.getClassName()).constructors(true)
.methods(true).build());

for (Class<?> parent : getHierarchy(mappingMetadata.getInterfaceType())) {
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(parent).methods(true).build());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.quarkus.it.smallrye.config;

import java.lang.reflect.Method;
import java.util.List;

import javax.enterprise.inject.Instance;
Expand Down Expand Up @@ -39,6 +40,13 @@ public Response getServer() {
return Response.ok(server).build();
}

@GET
@Path("/host")
public Response getServerHost() throws Exception {
Method method = server.getClass().getDeclaredMethod("host");
return Response.ok(method.invoke(server)).build();
}

@GET
@Path("/properties")
public Response getServerProperties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ void mapping() {
.body("log.period", equalTo("P1D"));
}

@Test
void serverHost() {
given()
.get("/server/host")
.then()
.statusCode(OK.getStatusCode())
.body(equalTo("localhost"));
}

@Test
void properties() {
given()
Expand Down

0 comments on commit 1b97bab

Please sign in to comment.