#28 Add support for Spring 3.2 and 4.0

v1.9.x
open
nobody
None
5
2015-04-28
2014-02-25
No

Until now, Jasypt only supports Spring up to 3.1. It would be nice to update this support to 3.2 and 4.0.

Discussion

  • Daniel Fernandez

    jasypt-spring31 is meant to support Spring versions 3.1 or newer...

    Are you experiencing any issues using jasypt-spring31 with Spring 3.2 or Spring 4?

     
  • Andreas Toom

    Andreas Toom - 2014-03-24

    Hi,

    We have Jasypt running great on an existing Spring 3.1 application with xml configuration and now we are developing a new application based on Spring Boot (Spring 4.x) with java based configuration.

    I'm trying to get Jasypt to integrate and decrypt property values in ANY propertysource detected by Spring Boot automatically but I'm unable to get it to work. I have declared a EncryptablePropertySourcesPlaceholderConfigurer and it is detected but it is only applied to local properties sources and not those defined in the environment.

    Instead of me doing to workaround I felt it was best to ask here and see if you have a Spring 4.x integration guide or any other pointers that can be useful?

    /Andreas

     
  • Scott Tatum

    Scott Tatum - 2015-04-28

    Well, I'm sure you've moved on by now, either successfully or unsuccessfully, but I have some pointers for using jasypt with Spring 4.0/JavaConfig. We have gotten it working successfully, after a bit of trial and error. If not for your benefit, then for posterity.

    The two pointers I would offer are this:

    First, make sure your placeholder bean and associated beans are declared as static. These have to be initialized early so that the Spring context has access to them for placeholder operations. There may be a way to get around this with some other way of telling the context to load these beans first, but making them static definitely works.

    Then, to use a placeholder, use the @Value annotation to do it. Example: @Value=("${prop_name}"). This is working for us. With Spring Boot, you can also use the @ConfigurationProperties(prefix="blah"), but in our experience, the properties did not get decrypted when attempting it this way. Only directly using @Value worked for us.

    I hope this helps, for you or for anyone else trying to use jasypt with Spring 4/Java. I get the feeling this issue may not be addressed any time soon.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks