Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In Spring Boot, I know that I can replace application.properties 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:

...
@Configuration
@EnableAutoConfiguration
@EnableWebMvc
@EnableScheduling
@PropertySource({"classpath:application.yml", "classpath:scheduling.yml"})
public class ApplicationConfig {
...
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
192 views
Welcome To Ask or Share your Answers For Others

1 Answer

  1. remove @PropertySource annotation, you not need it
  2. rename your scheduling.yml into src/main/resources/application-scheduling.yml
  3. add in src/main/resources/application.yml file next line:

    spring.profiles.include: 'scheduling'


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...