0

This is how I have set up external configuration file:

/** for .yaml file
@Configuration
@PropertySource("classpath:waterlvl.yaml")
@ConfigurationProperties("Alerts")
public class WaterLvlAlertConfig {

/** for .properties file
@Component
@PropertySource("classpath:waterlvl.properties")
public class WaterLvlConfig {

Properties are not being picked up, and my files are inside the resources file. I think the path I'm providing is wrong. What am I doing wrong?

halfer
  • 19,824
  • 17
  • 99
  • 186
Priyamal
  • 2,919
  • 2
  • 25
  • 52

1 Answers1

1

In spring boot @PropertySource cannot be used when using .yaml configuration. Refer to point 24.6.4 YAML shortcomings in externalized configuration documents. Also, a similar question is answered earlier, refer - Spring boot external configuration of property file

Martin
  • 448
  • 3
  • 10