-
Hey folks, I have a fairly small Quarkus application with some custom configuration interfaces as described in Mapping configuration to objects. While the Example: @ConfigMapping(prefix = "jobs")
public interface JobsConfig {
@NotNull
@DurationMin(minutes = 1L)
@WithDefault("PT5M")
Duration runInterval();
} Without
In this case, the configuration property is being used in a scheduled job: @ApplicationScoped
public class MyScheduledJob {
@Scheduled(every = "${jobs.run-interval}")
Uni<Void> runScheduledJob() {
// ...
}
} Any hints how to start debugging this?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
/cc @radcortez (config) |
Beta Was this translation helpful? Give feedback.
-
Because the mapping is not used anywhere (other than as a weak reference for an expanded default), Quarkus thinks it is not required and removed it from the final application. In this case, annotate the mapping with |
Beta Was this translation helpful? Give feedback.
Yes, do it like this:
If you inject the mappings, the validation is triggered, and you don't even need the
@Unremoveable
annotation.BTW, if you have a mapping, you might as well just use it instead of injecting
@ConfigProperty(name = "application.port") int port