The title is as it is.
In SpringBoot 2.3.0 or later, if you use a placeholder like classpath: /something-config-${spring.profiles.active} .yml
to specify the value of @ PropertySource
, you will not be able to resolve it and an exception will occur. appear.
The latest version of Boot today is 2.3.1.
Source
SomethingConfig.java
@Configuration
@ConfigurationProperties(prefix = "something")
@Component
@PropertySource(value = {"classpath:/something-config.yml","classpath:/something-config-${spring.profiles.active}.yml"}, factory = YamlPropertySourceFactory.class)
@Data
public class SomethingConfig {
private String setting1;
private String setting2;
}
result
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.profiles.active' in value "classpath:/somethign-config-${spring.profiles.active}.yml"
I used 2.2 series for the time being.
issue
https://github.com/spring-projects/spring-boot/issues/21631
Recommended Posts