package com.elab.core.spring.conditional;

import com.elab.core.spring.DaoScannerRegister;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * 判断是否是注解开启
 *
 * @author ： liukx
 * @time ： 2020/4/1 - 19:53
 */
public class EnableConditional implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        DaoScannerRegister bean = conditionContext.getBeanFactory().getBean(DaoScannerRegister.class);
        if (bean == null) {
            return true;
        }
        return false;
    }
}
