介绍
这篇文章将为大家详细讲解有关如何在春天中对配置文件进行加密,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
通过继承春天配置类并重写处理方法实现密文解密
public class EncryptPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { ,private String [], encryptPropNames =, {“username",,“password"},, @Override protected void  processProperties (ConfigurableListableBeanFactory beanFactory, Properties 道具),throws BeansException  { try { for (int 小姐:=,0;i配置中文件,并在jdbc。属性中设置密文(根据解密秘钥生成)
& lt; !——,类填写刚才那段代码的类路径——比; & lt; bean id=皃ropertyConfigurer",类=癱om。* * .EncryptPropertyPlaceholderConfigurer"祝辞, ,,,,,& lt; property name=發ocations"比; ,,,,,,,& lt; list> ,,,,,,,,,& lt; value>类路径:jdbc.properties ,,,,,,,& lt;/list> ,,,,,& lt;/property> & lt;才能/bean>关于如何在春天中对配置文件进行加密就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看的到。
如何在春天中对配置文件进行加密