Spring使用Properties配置进行加密
来源:互联网 发布:运维和java哪个好 编辑:程序博客网 时间:2024/05/07 21:35
spring配置使用Properties时,字段要求加密。不多说,直接上代码。
使用自定义的propertyConfigurerl类。
<bean id="propertyConfigurer" class="com.cneport.cusoa.config.MyConfigurer"><property name="locations"><list><value>/WEB-INF/deploy.properties</value></list></property></bean>
<bean id="dataSource"class="org.springframework.jdbc.datasource.DriverManagerDataSource"destroy-method="close"><property name="driverClassName" value="${jdbc.driver}" /><property name="url" value="${jdbc.url}" /><property name="username" value="${jdbc.username}" /><property name="password" value="${jdbc.password}" /></bean>解密类propertyConfigurerl:
public class MyConfigurer extends PropertyPlaceholderConfigurer { @Override protected void processProperties( ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException { String password = props.getProperty("jdbc.password"); if (password != null ) { props.setProperty("jdbc.password", IDEAEncrytion.getDesString(password)); (解密方法) } super.processProperties(beanFactory, props); } }
0 0
- Spring使用Properties配置进行加密
- spring boot 使用application.properties 进行外部配置
- spring boot 使用application.properties 进行外部配置
- spring boot 使用application.properties 进行外部配置
- spring boot 使用application.properties 进行外部配置
- 使用properties配置spring
- Spring中使用properties配置
- spring加密properties文件
- spring加密properties文件
- Spring无配置使用properties文件
- 使用Spring的ReloadableResourceBundleMessageSource读取properties配置
- SPRING使用占位符读取字段加密的properties文件
- Spring 中使用jasypt对配置文件(.properties)中密码加密
- Spring 中使用jasypt对配置文件(.properties)中密码加密
- Spring 中使用jasypt对配置文件(.properties)中密码加密
- 使用spring的PropertyPlaceholderConfigurer加密properties文件中的属性
- Spring框架使用properties配置数据源Bean【Spring入门】
- spring log4j properties 配置
- 分析jrtplib收发RTCP包
- springMVC项目引入jstl标签库若干问题的总结
- Win7&Win8 64bit Source Insight
- 黑马程序员_java的IO流一_13
- css3工具相关
- Spring使用Properties配置进行加密
- 视图、索引、存储过程 、触发器、游标及事务
- perl 基础学习(2)
- SSH框架问题——struts2 action result type类型
- 如何防止域名被盗
- CreateFile() -- 打开与创建文件
- Object-C中对“引用(reference)”的理解
- java语言基本组成
- grep、sed和awk基本用法汇总