听说你SpringBoot用得贼溜,那么相关注解你又知多少(持续更新)

目录

Spring的Annotation

org.springframework.stereotype包下

org.springframework.beans.factory.annotation包下

org.springframework.context.annotation包下

org.springframework.validation.annotation包下

org.springframework.scheduling.annotation包下

org.springframework.cache.annotation包下

org.springframework.web.bind.annotation

javax.annotation

javax.validation


 

我整理了下常用的spring boot的注解脑图

Spring的Annotation

  • org.springframework.stereotype包下

    • @Component   泛指所有组件
      • @Controller  控制器组件
      • @Reposity  数据访问组件,如DAO层
      • @Service  业务处理层组件
    • @Indexed   注解添加索引,以提升应用启动性能
  • org.springframework.beans.factory.annotation包下

    • @Autowired   自动注入类、方法、构造函数
      • 按照类去匹配,配合 @Qualifier 指定按照名称去装配 bean。
    • @Configurable  非Spring管理的类中使用依赖注入
      • https://blog.csdn.net/u013066244/article/details/89061676
    • @Value  将外部的值动态注入到Bean中
      • https://www.cnblogs.com/wangbin2188/p/9014837.html
    • @Lookup  方法注入
      • https://www.jb51.net/article/140402.htm
    • @Qualifier   通过这个标示,表明了哪个实现类才是我们所需要的
      • https://blog.csdn.net/qq_36567005/article/details/80611139
      • https://www.cnblogs.com/chenxiaoxian/p/9760032.html
  • org.springframework.context.annotation包下

    • @Configuration   表示这个类可以使用 Spring IoC 容器作为 bean 定义的来源
      • https://www.cnblogs.com/Guhongying/p/10600795.html
    • @Bean   该对象应该被注册为在 Spring 应用程序上下文中的 bean
      • https://www.cnblogs.com/feiyu127/p/7700090.html
    • @ComponentScan  定义扫描的路径从中找出标识了需要装配的类自动装配到spring的bean容器中
      • https://www.cnblogs.com/jpfss/p/11171655.html
    • @Scope  作用域,在 Spring IoC 容器中具有以下几种作用域:基本作用域singleton(单例)、prototype(多例)
      • https://www.cnblogs.com/nemowang1996/p/11195266.html
    • @PropertySource
    • @Lazy
    • @Import
  • org.springframework.validation.annotation包下

    • @Validated
  • org.springframework.scheduling.annotation包下

    • @Async
    • @EnableAsync
    • @EnableScheduling
    • @Scheduled
    • @Schedules
  • org.springframework.cache.annotation包下

    • @Cacheable
    • @CacheConfig
    • @CacheEvict
    • @CachePut
    • @Caching
    • @EnableCaching
  • org.springframework.web.bind.annotation

    • @Mapping
      • @RequestMapping  通用请求注解
        • @PostMapping  POST请求注解
        • @GetMapping   GET请求注解
        • @PutMapping   PUT请求注解
        • @DeleteMapping  Delete请求注解
        • @PatchMapping
    • @ModelAttribute
    • @PathVariable
    • @RequestAttribute
    • @RequestBody
    • @RequestMethod
    • @RequestParam
    • @ResponseBody
    • @RestController
    • @RestControllerAdvice
    • @ControllerAdvice
    • @ExceptionHandler
  • javax.annotation

    • @Generated
    • @PostConstruct
    • @PreDestroy
    • @Resource
    • @Resources
    • javax.annotation.security
      • @DeclareRoles
      • @DenyAll
      • @PermitAll
      • @RolesAllowed
      • @RunAs
    • javax.annotation.sql
      • @DataSourceDefinition
  • javax.validation

    • @Constraint
    • @Valid
    • @OverridesAttribute
    • javax.validation.constraints
      • @AssertFalse & AssertTrue
      • @DecimalMax & DecimalMin
      • @DecimalMin
      • @Digits
      • @Email
      • @Future & @FutureOrPresent
      • @Max  &  @Min
      • @Negetive  & NegativeOrZero
      • @Positive  &  @PositiveOrZero
      • @NotBlank & @NotEmpty &  @NotNull  & @Null
      • @Past &  @PastOrPresent
      • @Pattern
      • @Size

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

涛声依旧Cjt

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值