Jasypt 在 Spring Boot 中的应用
| By Sword.Liue
Jasypt(Java Simplified Encryption)
按照官方的说法:Jasypt(Java Simplified Encryption)是一个Java库,它使开发人员能够以最少的编码向其项目添加基本加密功能,而无需对加密的工作原理有太过深入的了解。
Jasypt (Java Simplified Encryption) is a java library which allows the developer to add basic encryption capabilities to his/her projects with minimum effort and without the need of having deep knowledge on how cryptography works.
1. 自动配置
如果你使用的是 Sping Boot, 并且开启了自动配置,那么请继续往下看,如果没有,可以直接跳过本节
# 开启了自动配置的 Spring Boot 启动类 # 长这样 @SpringBootApplication ... public class CicishopApp { } # 或者 长这样 @EnableAutoConfiguration ... public class CicishopApp { }
1.1 添加 mvn 依赖
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.1.2</version>
</dependency>
如果你的 Spring Boot 版本是 Version 2.1.X,那么请使用
<version>3.0.X</version>
截至 2020-05-30,Jasypt 的最新 starter 版本是 v3.0.2
Maven Central 也可以找到它([
jasypt-spring-boot-starter
]([https://search.maven.org/classic/#search%7Cgav%7C1%7Cg%3A%22com.github.ulisesbocchio%22%20AND%20a%3A%22jasypt-spring-boot-starter%22](https://search.maven.org/classic/#search|gav|1|g%3A"com.github.ulisesbocchio" AND a%3A"jasypt-spring-boot-starter")))的最新版本