修改数据库配置
Sync All Branches to GitHub / sync (push) Successful in 2s

This commit is contained in:
2026-01-23 15:38:07 +08:00
parent 37ba2a02ad
commit 25264daed8
3 changed files with 21 additions and 19 deletions
@@ -6,9 +6,9 @@ spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
# 数据库连接信息 # 数据库连接信息
url: jdbc:mysql://127.0.0.1:3306/xiaoyishu?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true url: ENC(+rm/FjvaL/fDxkZu/G9zxQnSO2M60VFodOuZzxqlxzUyNN2ooNjH9mtVVZiqlqMm8EHDCBKYD/rI4e1VdaDlYtwL+WxdW2K6rujuUm1R0Mkjl1kphthDaiAK5tnPvtfffL4aVpBbA7oOUdsX0tCURzWvpjSFhDHlxtb4b+Ezx6JeHJoZDEJ0bErjDETLdjbIGDNdCsTCvz2wp1S5+AdW39S5C8kj4PNLIXkbckzKdhHm9ATLrixdveyBLmuBkDwLsE9XBmCFm0ipST5/SVg8WA==)
username: ENC(q6eB0z65vHf2Fsm/DGFZpOea+GFigZNdnInAw2YvW1vMLWGAANwp+AcGiZB8lT5c) username: ENC(B/DozYPqx155j/Gdh3QkCX/wGmuzLf1jumsbb1kF4GY6EjrlRdAatc8BlhrrR2J6)
password: ENC(ZUUg0fBx9YSK4c4hOtIpkBpNSXMbhsRCM0CBRYHYvSzJCXTu9dK4gMgODcKgyooo67Osmm2ccgBeHbJheSMTCQ==) password: ENC(JwQdlswsrwmGE6eplp6Jk9Vp5s6zlFgra6jLN5fKBt8qOyqQHUHCJM6JcKp5g0t8B/or2wTH18ohR/d41oyV9w==)
druid: # Druid 连接池 druid: # Druid 连接池
initial-size: 5 # 初始化连接池大小 initial-size: 5 # 初始化连接池大小
min-idle: 5 # 最小连接池数量 min-idle: 5 # 最小连接池数量
@@ -43,9 +43,9 @@ spring:
data: data:
redis: redis:
database: 0 # Redis 数据库索引(默认为 0) database: 0 # Redis 数据库索引(默认为 0)
host: 127.0.0.1 # Redis 服务器地址 host: ENC(W8nbSo0vMjCenHHLHyhvdhW2wH3oI54/FW+LQp8H9lx6xQH2Tm56nGSgNom6xsK7) # Redis 服务器地址
port: 6379 # Redis 服务器连接端口 port: 6379 # Redis 服务器连接端口
password: 12345678 # Redis 服务器连接密码(默认为空) password: ENC(iK/k0IGPflACqYMUwX4N/sGvCVuysYywLcAO+Ikeqk326V8hCr8dgEGzkiEIwWOo) # Redis 服务器连接密码(默认为空)
timeout: 5s # 读超时时间 timeout: 5s # 读超时时间
connect-timeout: 5s # 链接超时时间 connect-timeout: 5s # 链接超时时间
lettuce: lettuce:
@@ -73,8 +73,8 @@ logging:
top.crushtj.xiaoyishu.auth.domain.mappers: debug top.crushtj.xiaoyishu.auth.domain.mappers: debug
aliyun: aliyun:
accessKeyId: ENC(h8yRFpNaFNA3NduXrnm8Z4D1jZr1UNapbYVdBxaSKsZMSn1RqJQ29RmqsZscxsea5vKuLdywVE+CYP3+Q+ZQ/A==) accessKeyId: ENC(0GWRL+sq6nY4HvFY8tGqAJz/21NQm4Ga3Qbek+yiR3dwgk4TZXLpcoflD1pyXI/nrkzgcbZsiXXBd6FXW00GJA==)
accessKeySecret: ENC(/Ovw0XK2/fFIGXKxOdmdUHvFPI0pNSHBDkLyjAXdbQytlCCNnBW8hFBseN4t4juumjJ5AJ9KBgvgDYCV+/gWGg==) accessKeySecret: ENC(VUngnZ/ERJDRHmimA0CB7tla6LKIXB7K6jzRJjOg2kqc3KwtXwin+E3cnpJSe92daR5yLCcMa2kPYwy9h6lPqg==)
jasypt: jasypt:
encryptor: encryptor:
password: password:
@@ -20,13 +20,14 @@ import org.springframework.test.context.TestPropertySource;
@SpringBootTest @SpringBootTest
@Slf4j @Slf4j
@TestPropertySource(properties = {"jasypt.encryptor.password=GhaU7VjZd2b3M4Hbx4SelEXZc"}) @TestPropertySource(properties = {"jasypt.encryptor.password="})
public class EncryptTest { public class EncryptTest {
//@Autowired //@Autowired
//private StringEncryptor defaultLazyEncryptor; //private StringEncryptor defaultLazyEncryptor;
//private StringEncryptor pooledPbeStringEncryptor; //private StringEncryptor pooledPbeStringEncryptor;
@Value("${jasypt.encryptor.password}") @Value("${jasypt.encryptor.password}")
private String encryptorPassword; private String encryptorPassword;
/** /**
* Druid 密码加密 * Druid 密码加密
*/ */
@@ -34,7 +35,7 @@ public class EncryptTest {
@SneakyThrows @SneakyThrows
void testEncodePassword() { void testEncodePassword() {
// 你的密码 // 你的密码
String password = "HhpxE2HWE4bGTyB5"; String password = "";//密码
String[] arr = ConfigTools.genKeyPair(512); String[] arr = ConfigTools.genKeyPair(512);
// 私钥 // 私钥
@@ -52,7 +53,8 @@ public class EncryptTest {
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
// JDK 17适配的核心配置(关键参数必须完整) // JDK 17适配的核心配置(关键参数必须完整)
encryptor.setPassword(encryptorPassword); // AES-256要求密钥至少32位 String password = ""; // 加密密码
encryptor.setPassword(password); // AES-256要求密钥至少32位
encryptor.setAlgorithm("PBEWithHMACSHA512AndAES_256"); // JDK17原生支持的算法 encryptor.setAlgorithm("PBEWithHMACSHA512AndAES_256"); // JDK17原生支持的算法
encryptor.setKeyObtentionIterations(1000); // 迭代次数(固定值) encryptor.setKeyObtentionIterations(1000); // 迭代次数(固定值)
encryptor.setStringOutputType("base64"); // 输出格式(固定) encryptor.setStringOutputType("base64"); // 输出格式(固定)
@@ -60,21 +62,21 @@ public class EncryptTest {
encryptor.setIvGenerator(new RandomIvGenerator()); // AES必须的IV生成器 encryptor.setIvGenerator(new RandomIvGenerator()); // AES必须的IV生成器
// 待加密的原始值 // 待加密的原始值
String accessKeyId = "ayi"; String encry1 = ""; // 待加密的原始值1
String accessKeySecret = "HhpxE2HWE4bGTyB5"; String encry2 = ""; // 待加密的原始值2
try { try {
String cipherAccessKeyId = encryptor.encrypt(accessKeyId); String cipherAccessKeyId = encryptor.encrypt(encry1);
System.out.println("accessKeyId加密成功,密文:" + cipherAccessKeyId); System.out.println("字段1加密成功,密文:" + cipherAccessKeyId);
String decryptAccessKeyId = encryptor.decrypt(cipherAccessKeyId); String decryptAccessKeyId = encryptor.decrypt(cipherAccessKeyId);
System.out.println("accessKeyId解密成功,明文:" + decryptAccessKeyId); System.out.println("字段1解密成功,明文:" + decryptAccessKeyId);
String cipherAccessKeySecret = encryptor.encrypt(accessKeySecret); String cipherAccessKeySecret = encryptor.encrypt(encry2);
System.out.println("accessKeySecret加密成功,密文:" + cipherAccessKeySecret); System.out.println("字段2加密成功,密文:" + cipherAccessKeySecret);
String decryptAccessKeySecret = encryptor.decrypt(cipherAccessKeySecret); String decryptAccessKeySecret = encryptor.decrypt(cipherAccessKeySecret);
System.out.println("accessKeySecret解密成功,明文:" + decryptAccessKeySecret); System.out.println("字段2解密成功,明文:" + decryptAccessKeySecret);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
System.out.println("加密失败原因:" + e.getMessage()); System.out.println("加密失败原因:" + e.getMessage());
@@ -17,7 +17,7 @@ import org.springframework.test.context.TestPropertySource;
@Slf4j @Slf4j
@SpringBootTest @SpringBootTest
@TestPropertySource(properties = {"jasypt.encryptor.password=GhaU7VjZd2b3M4Hbx4SelEXZc"}) @TestPropertySource(properties = {"jasypt.encryptor.password="})
public class ThreadPoolTaskExecutorTests { public class ThreadPoolTaskExecutorTests {
@Resource(name = "taskExecutor") @Resource(name = "taskExecutor")
private ThreadPoolTaskExecutor taskExecutor; private ThreadPoolTaskExecutor taskExecutor;