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?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.