SpringBoot注解总结

@SpringBootApplication 标记该类为主程序启动类
@RestController 等同Spring中的@Controller+@ResponseBody
@GetMapping("/xxx") 等同Spring中的@RequestMapping(RequestMethod.GET)
@RunWith(SpringRunner.class) 测试运行器,加载SpringBoot测试注解
@SpringBootTest 标记单元测试类,并加载项目的上下文环境ApplicationContext
@Autowired 把下句对象作为Bean注入Spring容器中
@Component 把被标注类作为Bean注入Spring容器中
@ConfigurationProperties(prefix="") 将配置文件中以person开头的属性注入到该类中
   
   
   
   
   
   
   
   
   
   
   
   
   
posted @ 2021-10-11 14:08  有何不可有  阅读(47)  评论(0)    收藏  举报