spring boot 配置数据库加密
来源:互联网 发布:访客网络的区别 编辑:程序博客网 时间:2024/06/07 12:25
1.pom.xml 文件中引入
<!-- https://mvnrepository.com/artifact/com.github.ulisesbocchio/jasypt-spring-boot-starter --><!-- 整合jasypt对数据库密码加密 --><dependency><groupId>com.github.ulisesbocchio</groupId><artifactId>jasypt-spring-boot-starter</artifactId><version>1.16</version></dependency>
2.在windows下命令生成加密密文
java -cp G:\maven\repository\org\jasypt\jasypt\1.9.2\jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="you4new!" password=saltnewfor algorithm=PBEWithMD5AndDES
参数说明:
input =数据库链接密码
password=加密字段,随意设置
algorithm= 算法
执行后有以下输出
----ENVIRONMENT-----------------Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.131-b11----ARGUMENTS-------------------algorithm: PBEWithMD5AndDESinput: you4new!password: saltnewfor----OUTPUT----------------------UK61bS+W/BskHl0N0ViAQcrPAmZLZZwO
3.在spring boot 项目的配置文件中加入以下内容
#spring.datasource.url=jdbc:mysql://localhost:3306/Solrsearch#spring.datasource.username=root#jasypt.encryptor.password=${password}#jasypt.encryptor.password=aidan123456#spring.datasource.password=ENC(UK61bS+W/BskHl0N0ViAQcrPAmZLZZwO)#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
https://www.ricston.com/blog/encrypting-properties-in-spring-boot-with-jasypt-spring-boot/
https://www.ricston.com/blog/encrypting-properties-in-spring-boot-with-jasypt-spring-boot/
http://www.cnblogs.com/zz0412/p/jasypt-001.html
https://github.com/ulisesbocchio/jasypt-spring-boot
阅读全文
0 0
- spring boot 配置数据库加密
- [spring-boot] 配置数据库
- Spring Boot 配置JdbcTemplate访问数据库
- Spring Boot配置数据库链接池
- Spring Boot链接数据库操作及配置
- spring-jdbc文件数据库配置加密
- Spring+Hibernate 数据库配置信息的加密
- spring-jdbc文件数据库配置加密
- spring-jdbc文件数据库配置加密
- spring+jpa配置加密的数据库信息
- spring boot 使用h2数据库配置(内存模式)
- Spring Boot 学习第二步 配置MySQL数据库+JPA
- Spring Boot+Maven 工程配置h2内存数据库
- Spring Boot-配置MongoDB、关系性数据库数据源
- Spring Boot 学习第二步 配置MySQL数据库+JPA
- Spring Boot+Maven 工程配置H2内存数据库
- Spring Boot 学习第二步 配置MySQL数据库+JPA
- Spring Boot,找不到数据库?
- 告别低俗,网络直播应当如何传递“正能量”?
- pullToRefreshListView的使用
- Python面试指南
- 第二章 列表和元组
- QuartZ Cron表达式
- spring boot 配置数据库加密
- Androidstudio添加背景图片
- SQL Server知识总结一
- C++四种强制类型转换符
- UOJ #119. 【UR #8】决战圆锥曲线 线段树 暴力 剪枝 卡常数
- WCF 协定中常用的操作
- MongoDB 复合索引
- c# 生成二维码图片
- CentOS搭建Mono开发环境