Spring Encrypt Values from Properties File

前端 未结 2 1808
野趣味
野趣味 2021-01-14 12:22

I am currently using a UserDetailsService to get values from a user file:



        
相关标签:
2条回答
  • 2021-01-14 12:39

    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

    0 讨论(0)
  • 2021-01-14 12:41

    Similar to what you expect can be found in http://kayalvizhiameen.blogspot.in/2014/04/handling-obfuscated-property-values-in.html

    0 讨论(0)
提交回复
热议问题