There is a Spring Boot 2 app with such a structure:
parent-module
module-1
src
main
java
resources
- application.yml
module-2
src
main
java
resources
- application.yml
Also, module-1 depends on module-2, specified in pom.xml dependencies
section.
The problem is that when I specify some properties in module-2's application.yml
- they are not visible in main module-1's components (via @Value
annotation).
As was answered here seems like module-1's application.yml
overrides module-2's application.yml
. There is a workaround - if I use name application.yaml
in module-2 everything works fine, but I'm going to add more modules and, finally, it's dirty hack.
What I'm doing wrong? Should such an hierarchy of property files specified somehow? I will be happy to provide more details if it's needed.
Thank you!