Spring、SpringMVC、Spring Boot 中的注解

Spring SpringMVC Spring Boot About 1,011 words

Spring

core

  • @Order

AOP

  • @EnableAspectJAutoProxy

依赖注入

  • @Autowired
  • @Value
  • @Qualifier
  • @Primary

组件和扫描

  • @Component
  • @Controller
  • @Service
  • @Repository
  • @Bean
  • @ComponentScan
  • @Import
  • @ImportResource
  • @Lazy
  • @Scope

配置

  • @Configuration
  • @Conditional
  • @Profile
  • @PropertySource

事务

  • @EnableTransactionalManagement
  • @Transactional

事件

  • @EventListener

异步

  • @EnableASync
  • @Async

调度

  • @EnableScheduling
  • @Scheduled

SpringMVC

Mapping

  • @RequestMapping
  • @GetMapping
  • @PostMapping

REST

  • @RestController
  • @RequestBody
  • @ResponseBody
  • @ResponseStatusHTTP的请求头中的status

参数

  • @PathVariable
  • @RequestParam
  • @RequestHeader
  • @CookieValue

统一处理

  • @RestControllerAdvice
  • @ControllerAdvice
  • @ExceptionHandler

转换和格式化

  • @DateTimeFormat
  • @NumberFormat

跨域

  • @CrossOrigin

Spring Boot

Auto

  • @SpringBootApplication
  • @EnableAutoConfiguration
  • @SpringBootConfiguration

Properties

  • @EnableConfigurationProperties:开启解析自动配置
  • @ConfigurationProperties:属性配置类

Conditional

  • @ConditionalOnClass:存在指定的Class
  • @ConditionalOnMissingBean:不存在指定的Bean
  • @ConditionalOnProperty:配置了指定的属性
Views: 1,697 · Posted: 2021-12-30

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh