There is a way to do it, however it might not be the best way. Suppose you have following application.yml:
spring:
some-config:
password: FILE(xxx)
username: FILE(yyy)
other-properties: FILE(zzz)
Create following config file:
@Configuration
@ConfigurationProperties("spring.some-config")
public class SomeConfigSettings {
private String password;
private String username;
private String otherProperties;
private String getPassword() {
return this.password;
}
private void setPassword(String password) {
this.password = FileUtil.read(password)
}
// Provide getter/setters for remaining fields
.......
}
During application startup spring will call setter methods with values provided in application.yml. All you need is to implement your FileUtil.read method, so that it will use your format FILE(/file/path).
Then you may access spring.some-config properties in your beans:
@Autowire
private SomeConfigSettings someConfigSettings;
....
public void someMethod() {
someConfigSettings.getPassword();
}