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容器与否