I have a Spring Boot application where I would like to inject values into a @ConfigurationProperties bean in a specific order.
For example,
@ConfigurationProperties("myproperties")
class MyProperties {
private String property1;
....
}
base-application.yml
myproperties:
property1: some-value
The above class and properties file is in a jar file. In the mail application of my Spring Boot app (which has the above jar as dependency) I used @PropertySource(value = { "application.yml", "base-application.yml"})
but got null
values in MyProperties
.
I tried
@PropertySources({
@PropertySource("classpath:application.yml"),
@PropertySource("classpath*:base-application.yml")
})
as well, but that didn't work either.
If I add the myproperties.property1 value in application.yml then it works fine. Is it possible to inject property values from a property file which is inside of another jar? If so, what am I doing wrong here?