Judging by the source code of jasypt library (EncryptionNamespaceHandler and EncryptorFactoryBean) and the API for PooledPBEStringEncryptor I'm assuming you can start experimenting with something like this:
@Bean
public EnvironmentStringPBEConfig environmentVariablesConfiguration() {
EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig();
config.setAlgorithm("PBEWithMD5AndDES");
config.setPasswordEnvName("APP_ENCRYPTION_PASSWORD");
return config;
}
@Bean
public PooledPBEStringEncryptor stringEncryptor() {
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
encryptor.setConfig(environmentVariablesConfiguration());
return encryptor;
}
One note, though: I don't know anything about Jasypt, but I see their package names and documentation and everything is around spring 2, 3 and 3.1. Nothing about Spring 4. So, I don't say it won't work, but it is something to keep in mind in case things that look like they should work, but they don't.
As for @PropertySource
I think you need something around these lines:
@Configuration
@Profile(value="prod")
@PropertySource("classpath:prod.properties")
public class ProdPlaceholderConfig {
...
}
@Configuration
@Profile(value="dev")
@PropertySource("classpath:dev.properties")
public class DevPlaceholderConfig {
...
}