💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
**1.依赖管理** ~~~ <!-- spring整合junit测试 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> ~~~ **2.项目运行** //创建spring容器 //classes 指定引导类 @SpringBootTest(classes = SpringbootMybatisApplication.class) **3.测试代码** ~~~ import com.nobb.SpringBootDemo; import com.nobb.service.User; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest(classes = SpringBootDemo.class) public class MyTest { @Autowired private User user; @Test public void fun1(){ System.out.println(user.test()); } } ~~~