- use in gradle project
- Step 1. Add the JitPack repository to your build file
- Step 2. Add the dependency
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.FutaoSmile:starter-fustack:Tag'
}
- use in maven project
- Step 1: Add the JitPack repository to your build file
- Step 2. Add the dependency
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.FutaoSmile</groupId>
<artifactId>starter-fustack</artifactId>
<version>Tag</version>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
- 设置密码:
jasypt.encryptor.password=xxx
- 不可以被泄露哟,可以在IDEA的Program arguments设置。
- 加密命令
mvn jasypt:encrypt-value -Djasypt.encryptor.password="the password" -Djasypt.plugin.value="theValueYouWantToEncrypt"
- 加密解密
@Autowired
private StringEncryptor encryptor;
@Override
public void run(String... args) throws Exception {
System.out.println(encryptor.encrypt("123456"));
System.out.println(encryptor.decrypt("12mXd8r6ni5ZGrqOOm7xNxkyJJImJzysOjY6JqZo2Ouj2Hf/Azlpzdf1BW+Rczl0t63UCeoS1yVZe3v3DLiQIA=="));
}
- 编码流程
- 在编写好其他模块之后,将其他模块的依赖引入
- 设置该模块的
<optional>true</optional>
- 设置该模块的
- 创建自动配置类
- 包名 =
模块名
- 类名 =
模块名AutoConfiguration
- 包名 =
- 编写
XxxAutoConfiguration
类- 启用条件
- 导入扫描类
- 在resources/META-INF/spring.factories文件的
org.springframework.boot.autoconfigure.EnableAutoConfiguration
属性下加入新写的自动配置类,并用逗号分隔 - 打包,发布
- 在编写好其他模块之后,将其他模块的依赖引入
- 地址: jitpack.io
- github上设置release