I am currently using a UserDetailsService
to get values from a user file:
Take a look at Jasypt, it is a java library which allows the developer to add basic encryption capabilities to his/her projects with minimum effort, and without the need of having deep knowledge on how cryptography works.
You can see how to configure it with Spring here
As an alternative, you may also implement your own propertyPersister
to do the (d)encryption:
classpath:com/foo/jdbc.properties
Take a look at the example here