-
I'm trying to use Everything works great in Quarkus 2.3.1.Final like #20916
@ConfigMapping(prefix = "server")
public interface ServerConfig {
String host();
}
@ApplicationScoped
public class ServerClient {
public String get() {
SmallRyeConfig config =
ConfigProvider.getConfig().unwrap(SmallRyeConfig.class);
ServerConfig server = config.getConfigMapping(ServerConfig.class);
return server.host();
}
}
@Path("/api/v1/server")
public class ServerResource {
@GET
public String getServer() {
return new ServerClient().get();
}
} Am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Answered by
edufolly
Dec 21, 2021
Replies: 2 comments 4 replies
-
Follow @mkouba answer:
@ConfigMapping(prefix = "server")
public interface ServerConfig {
String host();
}
@ApplicationScoped
public class ServerClient {
@Inject
ServerConfig server;
public String get() {
return server.host();
}
}
@Path("/api/v1/server")
public class ServerResource {
@Inject
ServerClient client;
@GET
public String getServer() {
return client.get();
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
edufolly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Follow @mkouba answer:
application.properties
ServerConfig.java
ServerClient.java
ServerResource.java