前言
在项目开发中一般数据库连接信息,还有一些必要的配置信息都会配置在application.properties或者yml文件中,对于一些敏感信息例如密码、用户名等明文的话可能会出现安全隐患,所以一般都会进行加密,今天介绍一种加密方式——jasypt。
引入jar包
对于springboot项目使用@SpringBootApplication注解自动配置启动的可以直接在pom文件引入下面的包
<!--jasypt配置文件脱敏-->
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
如果未使用@SpringBootApplication自动配置的还需引入下边jar包
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot</artifactId>
<version>3.0.3</version>
</<