一、整合测试
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency>
@Before public void test01(){ System.out.println("aaaaaa"); } @Test public void test02(){ System.out.println("bbbbbb"); } @After public void test03(){ System.out.println("cccccc"); }
二、SpringBootApplication注解
//@EnableAutoConfiguration //@ComponentScan("com.wuxi") //********等价******** @SpringBootApplication(scanBasePackages = {"com.wuxi"})//默认情况下扫描的是当前包及当前包的子包
三、RestController注解
//@ Controller @RestController // Restful风格,等价@Controller+@ResponseBody public class IndexController { @RequestMapping("/lin/{id}") // @ResponseBody public Object requestFun(@PathVariable String id) { return id; } }
springboot整合测试_SpringBootApplication注解和RestController注解
原文:https://www.cnblogs.com/linding/p/12584439.html