Johan Frick Johan Frick - 1 year ago 1022
YAML Question

Spring Boot: how to use multiple yml files

In Spring Boot, I know that I can replace with application.yml and use the YAML format.
However, my application.yml is getting crowded so I need to split it up a bit. How can I do that? I would like to do something like this:

@PropertySource({"classpath:application.yml", "classpath:scheduling.yml"})
public class ApplicationConfig {

Answer Source

@PropertySource does not support YAML (probably it will in Spring 4.1). You can set spring.config.location or 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download