Closed ajainy closed 7 years ago
There's a limitation due to the way spring boot resolves properties for application.yml
or application.properties
.
There are 2 workarounds:
secret.url=ENC(sdfsdfds...)
secret.password
and secret.url
to a different property files together with:
@EncryptablePropertySource("classpath:encrypted.properties")
And you'll be able to make that indirection. There's a working sample here: https://github.com/ulisesbocchio/jasypt-spring-boot-samples/tree/master/jasypt-spring-boot-demo-simple
Thanks. I will try this.
as of 1.15 (which I just released) this should work out the box using either jasypt-spring-boot-starter
, @EnableEncryptableProperties
, StandardEncryptableEnvironment
or on custom property sources using @EncryptablePropertySource
.
Enjoy!
Use case:
secret.password=ENC(sdfsdfds...) secret.url=http://user:${secret.password}@domain.com
Now secret URL when accessed, looks like it is NOT decrypting. But when i tested
secret.url
by inject property in java bean, it shows right values.I am trying to build
spring.cloud.config.uri
in spring boot config client app, without exposing actual password.