org.jasypt.exceptions.EncryptionInitializationException: Password not set for Password Based Encryptor
@Bean
public static EncryptablePropertyPlaceholderConfigurer propertySourcesPlaceholderConfigurer(
@Qualifier("jasyptStringEncryptor") StandardPBEStringEncryptor encryptor) {
StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor();
standardPBEStringEncryptor.setPassword("123456");
String envValue = System.getenv("123456");
System.out.println("================="+envValue);
if(envValue.equals("123456")){
EncryptablePropertyPlaceholderConfigurer configurer = new EncryptablePropertyPlaceholderConfigurer(encryptor);
configurer.setLocation(new ClassPathResource("jdbc.properties"));
return configurer;
}
EncryptablePropertyPlaceholderConfigurer encryptablePropertyPlaceholderConfigurer = new EncryptablePropertyPlaceholderConfigurer(standardPBEStringEncryptor);
encryptablePropertyPlaceholderConfigurer.setLocation(new ClassPathResource("newjdbc.properties"));
return encryptablePropertyPlaceholderConfigurer;
}
提示报错没有设置解密 密码