主要提供一下方法

boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata);

true:表示装配

false:表示不装配

1.1、Conditional

  在Spring4中引入,其主要作用就是判断条件是否满足,从而决定是否初始化并向容器注册Bean

注解:Conditional() 参数是数组,数组内的都是true才装配

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Conditional {

    /**
     * All {@link Condition}s that must {@linkplain Condition#matches match}
     * in order for the component to be registered.
     */
    Class<? extends Condition>[] value();

}
View Code

相关文章:

  • 2021-08-22
  • 2021-12-15
  • 2021-06-13
  • 2021-08-07
  • 2022-12-23
  • 2021-06-28
猜你喜欢
  • 2021-07-11
  • 2022-02-07
  • 2021-10-30
  • 2021-08-01
  • 2021-09-11
  • 2021-07-15
相关资源
相似解决方案