zoukankan      html  css  js  c++  java
  • SpringBoot-注解一句话

    @Configuration 启动时将该类生成bean交给Spring管理

    @Bean 从方法中返回一个bean交给Spring管理,默认用方法名作为beanName,可指定name(推荐)

    @Primary 存在多个bean时首选你了

    @Qualifier 通过name得到一个bean,和@Autowired结合使用

    @PostConstruct 我来自java,我先跑,我只跑一次

    @Async 想让我干活,再给我一个线程,你可以不管我

    @Controller @Service @Repositry @Mapper 分层开发web服务的几个常客

    @Aspect 告诉我想额外的干些啥,我暗地里帮你搞定

    根据条件注入Bean

    @ConditionalOnBean 当容器有指定Bean的条件下注入

    @ConditionalOnMissingBean 当容器没有指定Bean的情况下才注入

    @ConditionalOnClass 当容器有指定类的条件下

    @ConditionalOnMissingClass 当容器没有指定类的情况下

    @ConditionalOnProperty 指定的属性是否有指定的值,如

    @ConditionalOnProperty(
    name = {"spring.kafka.jaas.enabled"}
    )

    @ConditionalOnSingleCandidate 当前指定Bean在容器中只有一个,或者虽然有多个但是指定首选Bean

    @ConditionalOnExpression 基于SpEL表达式作为判断条件   @ConditionalOnExpression("'true'.equals('${redis.enable}')")


  • 相关阅读:
    教学计划-物理必修二
    小白学习Python之路---开发环境的搭建
    解决pycharm连接MySQL 1366报错的问题
    Leetcode 118 杨辉三角
    Leecode 70 爬楼梯
    RabbitMQ
    Leetcode 38 报数
    Leecode 69 x的平方根
    select 实现server I/O多路复用通信
    Leetcode 67 二进制求和
  • 原文地址:https://www.cnblogs.com/yb38156/p/10152501.html
Copyright © 2011-2022 走看看