Spring Boot: how to use multiple yml files
- remove
@PropertySource
annotation, you not need it - rename your
scheduling.yml
intosrc/main/resources/application-scheduling.yml
add in
src/main/resources/application.yml
file next line:spring.profiles.include: 'scheduling'
@PropertySource
does not support YAML (probably it will in Spring 4.1). You can set spring.config.location
or spring.config.name
to a comma-separated list (e.g. as System property or command line argument).
Personally I like all my YAML in the same place (the structure really helps to break it up visually, and you can use documents inside the file to split it up more). That's just taste I guess.