Spring ConditionalOnProperty

Spring Annotation @ConditionalOnProperty

  • spring doc解釋
    • @Conditional: Indicates that a component is only eligible for registration when all specified conditions match.(ways: type-level, meta-annotation, method-level)
    • @ConditionalOnProperty: Conditional that checks if the specified properties have a specific value. By default the properties must be present in the Environment and not equal to false.
  • 用法
    • 經過配置文件控制bean註冊spring容器與否
相關文章
相關標籤/搜索