I need to load a property from a .yml file, which contains the path to a folder where the application can read files from.
I\'m using the following code
I've got that issue Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder cause I've set test spring boot profile in properties.yaml.
Spring can't find properties for test profile when run app with no profile.
So remove spring boot profile from properties or yaml or run app with enabled profile.
Configuration file example is below:
@Configuration
public class AppConfig {
@Value("${prop.foo}")
private String foo;
@Value("${prop.bar}")
private String bar;
@Bean
BeanExample beanExample() {
return new BeanExample(foo, bar);
}
}