本地编译文件

This commit is contained in:
Ken 2025-03-10 13:44:08 +08:00
parent 069f8122b9
commit 53fb54d216
4 changed files with 27 additions and 8 deletions

View file

@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}

View file

@ -168,6 +168,12 @@
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.5</version>
</dependency>
</dependencies> </dependencies>
<!-- 阿里云maven仓库 --> <!-- 阿里云maven仓库 -->

View file

@ -1,16 +1,23 @@
package xiaozhi; package xiaozhi;
import org.jasypt.encryption.StringEncryptor; import org.jasypt.encryption.StringEncryptor;
import org.junit.Test; // 如果使用 JUnit 5
import org.junit.runner.RunWith; import org.junit.jupiter.api.Test;
// 如果使用 JUnit 4,需要确保项目中添加了 JUnit 4 的依赖
// import org.junit.Test;
// 由于原导入语句无法解析,若使用 JUnit 5,移除该导入
// 若后续代码需要使用 JUnit 4 的 @RunWith 注解,需确保项目添加 JUnit 4 依赖
// 这里假设使用 JUnit 5,移除该导入
// import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; // import org.springframework.test.context.junit4.SpringRunner;
/** /**
* 单元测试 * 单元测试
*/ */
@RunWith(SpringRunner.class) // 由于原代码使用了 JUnit 5 的导入,这里移除 JUnit 4 的 @RunWith 注解
// 若后续需要使用 JUnit 4 的功能,需确保项目添加 JUnit 4 依赖
// @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DbEncTest { public class DbEncTest {

View file

@ -4,12 +4,15 @@ import xiaozhi.common.redis.RedisUtils;
import xiaozhi.modules.sys.entity.SysUserEntity; import xiaozhi.modules.sys.entity.SysUserEntity;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.junit.Test; // 若使用 JUnit 5,应导入以下包
import org.junit.runner.RunWith; import org.junit.jupiter.api.Test;
// 由于代码中使用了 JUnit 5 的 @Test 注解,应移除 JUnit 4 的 @RunWith 相关导入
// import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class) // 由于代码中使用了 JUnit 5 的 @Test 注解,应移除 JUnit 4 的 @RunWith 相关代码
// @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class RedisTest { public class RedisTest {
@Resource @Resource