SPRING 数据库密码加密存储 在配置文件的两种方式 第二种

简介: PropertyPlaceholderConfigurer SPRING 数据库密码加密存储 在配置文件的两种方式 第二种

spring

<context:property-placeholder local-override="true" properties-ref="dataSourceProperties"
file-encoding="UTF-8" location="classpath:loc/config.properties"

ignore-resource-not-found="true" />

3.1以前property-placeholder使用的是org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

支持

protected String convertProperty(String propertyName, String propertyValue)

 

}

不支持通配符

因此如下,重写convertProperty进行加解密,重写setLocation使其支持通配符*加载配置文件


application-context.xml加入

 
   <bean id="decryptPropertyPlaceholderConfigurer"
          class="com.spring.demo.utils.DecryptPropertyPlaceholderConfigurer"
          p:location="classpath*:*.properties,classpath*:loc/*.properties">
    </bean>



目录
相关文章
|
18天前
|
存储 SQL 关系型数据库
关系型数据库结构化数据存储
【5月更文挑战第9天】关系型数据库结构化数据存储
23 1
|
18天前
|
存储 SQL 关系型数据库
关系型数据库数据结构化存储
【5月更文挑战第8天】关系型数据库数据结构化存储
38 6
|
18天前
|
存储 负载均衡 监控
关系型数据库搭建高可用存储集群
【5月更文挑战第4天】关系型数据库搭建高可用存储集群
36 4
关系型数据库搭建高可用存储集群
|
2天前
|
关系型数据库 MySQL 应用服务中间件
tomcat 搭建博客 及破解数据库密码
tomcat 搭建博客 及破解数据库密码
|
5天前
|
XML 监控 Java
Spring Boot 配置文件
Spring Boot 配置文件
17 2
|
9天前
|
Java 容器 Spring
Spring的加载配置文件、容器和获取bean的方式
Spring的加载配置文件、容器和获取bean的方式
20 3
Spring的加载配置文件、容器和获取bean的方式
|
12天前
|
存储 安全 JavaScript
消防物资存储|基于SSM+vue的消防物资存储系统的设计与实现(源码+数据库+文档)
消防物资存储|基于SSM+vue的消防物资存储系统的设计与实现(源码+数据库+文档)
29 0
|
16天前
|
存储 Oracle 关系型数据库
关系型数据库文件方式存储CONTROL FILE(控制文件)
【5月更文挑战第11天】关系型数据库文件方式存储CONTROL FILE(控制文件)
27 1
|
16天前
|
存储 关系型数据库 数据库
关系型数据库文件方式存储LOG FILE(日志文件)
【5月更文挑战第11天】关系型数据库文件方式存储LOG FILE(日志文件)
76 1
|
16天前
|
存储 SQL Oracle
关系型数据库文件方式存储DATA FILE(数据文件)
【5月更文挑战第11天】关系型数据库文件方式存储DATA FILE(数据文件)
28 3