ulisesbocchio / jasypt-spring-boot

Jasypt integration for Spring boot
MIT License
2.91k stars 522 forks source link

[Question] How to use ENC placeholder as sub-string in property value #57

Closed ajainy closed 7 years ago

ajainy commented 7 years ago

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.

ulisesbocchio commented 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:

ajainy commented 7 years ago

Thanks. I will try this.

ulisesbocchio commented 7 years ago

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!