ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 导包 ~~~ <!--测试启动器--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> </dependency> ~~~ ## 自动生成测试类 ![](https://box.kancloud.cn/6b0d24a79af5b054ae0664e33f3c3996_1534x502.png) ## 测试 ~~~ package com.like.mapper; import com.like.pojo.User; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest //使用springboot 测试启动类 public class UserMapperTest { @Autowired private UserMapper userMapper; @Test public void test() { User user = userMapper.selectByPrimaryKey(1L); System.out.println(user); } } ~~~