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:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:com/foo/jdbc.properties</value>
</property>
<property name="propertiesPersister">
<bean class="com.mycompany.MyPropertyPersister" />
</property>
</bean>
Take a look at the example here
Similar to what you expect can be found in http://kayalvizhiameen.blogspot.in/2014/04/handling-obfuscated-property-values-in.html