一、核心启动注解 1. @SpringBootApplication 作用:Spring Boot应用的入口注解,组合了@Configuration、@EnableAutoConfiguration和@ComponentScan 使用场景:主启动类上必须使用 示例: 1 2 3 4 5 6 @SpringBootApplication
一、核心启动注解1. @SpringBootApplication
2. @EnableAutoConfiguration
3. @Configuration
4. @ComponentScan
二、Bean定义与管理1. @Bean
2. @Component/@Service/@Repository/@Controller
3. @ConfigurationProperties
4. @Scope
三、依赖注入1. @Autowired
2. @Qualifier
3. @Value
四、Web MVC开发1. @RestController/@Controller
2. @RequestMapping/@GetMapping/@PostMapping等
3. @RequestBody/@ResponseBody
4. @PathVariable/@RequestParam
五、数据访问1. @Entity/@Table
2. @Transactional
3. @RepositoryRestResource作用:将JPA仓库暴露为REST端点 使用场景:快速开发RESTful数据服务 示例:
六、测试相关1. @SpringBootTest
2. @WebMvcTest
七、高级特性1. @EnableCaching/@Cacheable
2. @EnableScheduling/@Scheduled
3. @Async
最佳实践建议
|
2021-06-05
2021-05-27
2021-05-26
2021-06-05
2021-05-16