通过test类进行单元测试 在pom文件中test依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> 在指定的test/java目录下进行编写,然后在里面创建测试类