I'm facing following problem with @ConfigurationProperties
placed on @Bean
.The configuration is placed into application.yml within the library jar by default:
@Configuration
@ConfigurationPropertiesScan
public class MyConfiguration {
@ConfigurationProperties("myprefix")
@Bean
public MyConfigProperties configProperties(){
return new MyConfigProperties();
}
}
MyConfigProperties.java - simple pojo
public class MyConfigProperties {
private String myproperty;
public String getMyproperty( ...
public void setMyproperty( ...
}
application.yml
myprefix:
myproperty: defaultValue
From the @SpringBootTest
in the same project it works just fine. But if I use the library from another project, I always need to provide the myprefix.myproperty
even the defaulValue
would work fine for me.
My expectation is, the defaultValue
should be taken from the application.yml provided within the jar, if no properties with higher precedence given.
Am I doing something wrong?
Kind regards,
Gena