0

I have an application.yml file and a sensitive-data.yml. I would like the properties in these files to be used brushed together. Is there any way to do that?

mpontsasa
  • 11
  • 7

1 Answers1

0

Use can use @PropertySource

@PropertySource("classpath:foo.properties")
@PropertySource("classpath:bar.properties")
public class PropertiesWithJavaConfig {
    //...
}

This link will help you: https://www.baeldung.com/properties-with-spring

koha13
  • 41
  • 2
  • First of all, I have yml files, and if I'm not mistaken, PropertySource only works with properties files. Also, I would be interested if this could be done outside of code. – mpontsasa Dec 30 '20 at 10:28
  • Maybe this approach will work: https://stackoverflow.com/questions/23134869/spring-boot-how-to-use-multiple-yml-files – koha13 Dec 30 '20 at 10:36
  • I marked this accepted because it solved my problem, but I am still waiting for a more appropriate solution. – mpontsasa Dec 30 '20 at 11:36