feca347ebb05bb34acf1d6e5320fa3537e5aa9ac.svn-base 713 B

12345678910111213141516171819202122
  1. package org.jeecg.config;
  2. import org.jeecg.common.constant.CommonConstant;
  3. import org.springframework.context.annotation.Condition;
  4. import org.springframework.context.annotation.ConditionContext;
  5. import org.springframework.core.type.AnnotatedTypeMetadata;
  6. /**
  7. * 微服务环境加载条件
  8. */
  9. public class JeecgCloudCondition implements Condition {
  10. @Override
  11. public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
  12. Object object = context.getEnvironment().getProperty(CommonConstant.CLOUD_SERVER_KEY);
  13. //如果没有服务注册发现的配置 说明是单体应用
  14. if(object==null){
  15. return false;
  16. }
  17. return true;
  18. }
  19. }