Spring Download - Download application.properties/yml from the dependent jar

I have a Spring boot application where I would like to enter values ​​in the @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 are in the jar file. In the mail application of my Spring Boot application (with the above jar as a dependency) I used @PropertySource(value = { "application.yml", "base-application.yml"}) but got the values nullin MyProperties.

I tried

@PropertySources({
    @PropertySource("classpath:application.yml"),
    @PropertySource("classpath*:base-application.yml")

}) 

but that didn't work either.

If I add the value myproperties.property1 to application.yml then it works fine. Can I enter property values ​​from a property file that is inside another jar? If so, what am I doing wrong here?

+1
2

YAML @PropertySource. , , , .

+2

META-INF jar, : "* :./META-INF/* "

0

All Articles