Closed 554330833 closed 4 years ago
proxy-property-sources is not a property of the StringEncryptor because it doesn't affect how the StringEncryptor works. It affects how the StringEncryptor is applied by this starter.
You should be able to set proxy-property-sources to true via any of the other means e.g. a system property, whilst still providing the configuration for the encryptor as a custom bean.
Alternatively, you could provide all of this configuration via a property file instead of as a custom bean, given that, in your example, you aren't doing anything that couldn't be set as a property.
@ulisesbocchio you may wish to consider separating properties according to how and when they can be applied to avoid this confusion. For example, reserve jasypt.encryptor. only for those properties that are set on the encryptor directly, move the resolver properties to jasypt.resolver. and move properties that affect the starter itself up to jasypt.
like: jasypt: encryptor: password: 123 proxy-property-sources: true algorithm: PBEWITHHMACSHA512ANDAES_256 saltGeneratorClassName: org.jasypt.salt.RandomSaltGenerator ivGeneratorClassName: org.jasypt.iv.RandomIvGenerator stringOutputType: base64
if i use bean to create is lack of proxy-property-sources: true, i can not find how to set it
@Bean("jasyptStringEncryptor") public StringEncryptor stringEncryptor() { PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); SimpleStringPBEConfig config = new SimpleStringPBEConfig(); config.setPassword("123"); config.setAlgorithm("PBEWITHHMACSHA512ANDAES_256"); config.setKeyObtentionIterations("1000"); config.setPoolSize("1"); config.setProviderName("SunJCE"); config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator"); config.setStringOutputType("base64"); encryptor.setConfig(config); return encryptor; }
i can not set proxy-property-sources: true, if haven't set this value, my framework which use j2cache is fail(why?),i use yaml config is success but use custom StringEncryptor is fail because it can not set proxy-property-sources: true