Nacos + Jasypt 配置加密考虑到安全性,最好将配置文件中的敏感信息进行加密。例如说,MySQL 的用户名密码、第三方平台的Token令牌等等
- 1、增加pom引入
com.github.ulisesbocchio jasypt-spring-boot-starter3.0.2
- 2、新增nacos配置
- 3、JasyptTest 测试类进行加密
package com.example.nacosConfig.controller; import org.jasypt.encryption.StringEncryptor; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.Spri