I have a module for database communication(my-db-lib), and which is imported to spring boot based web application module(my-web-app)
I want to set configuration about db in my-db-lib, and set about web app in my-web-app
my-db-lib
db:
url: localhost
my-web-app
app:
message: hello
When my-web-app runs, it can read only app.message not db.url
It seems that yml files are just replaced with one which has highest priority (when not use profiles) Is it right? How can I achieve purpose?
Thanks, And sorry for my poor English :D
As a trick, I moved the other application.yml to the '/config' folder.
This should probably work.
my-db-lib/src/main/resources/config/application.yml
my-web-app/src/main/resources/application.yml
Perhaps you need to use a sufficiently high version of Spring Boot.
Note: Folders different from '/config', such as '/config/db', will not work.
The application.yml in child module will be override by application.yml in parent module.
You can use this:
application-my-db-lib.yml for module my-db-libapplication.yml for module my-web-appIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With