Spring boot 使用的注解有哪些?

  • Spring boot 使用的注解有哪些?
注解 作用
@SpringBootApplication 等价于 @Configuration + @EnableAutoConfiguration + @ComponentScan
@Autowired
@RestController 等价于 @Controller + @ResponseBody
@RequestMapping
@Controller 对应表现层的Bean,也就是Action
@Service 对应的是业务层Bean
@Repository 对应数据访问层Bean
@Component @Component 是 @Controller @Service @Repository 的父类,不能在语义上表明这个类所处的层级,因此不推荐使用
原文地址:https://www.cnblogs.com/cag2050/p/7097635.html