org.springframework.context.annotation.Profile.value()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.springframework.context.annotation.Profile.value()方法的一些代码示例,展示了Profile.value()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Profile.value()方法的具体详情如下:
包路径:org.springframework.context.annotation.Profile
类名称:Profile
方法名:value

Profile.value介绍

暂无

代码示例

代码示例来源:origin: cloudyrock/mongock

private boolean matchesActiveSpringProfile(AnnotatedElement element) {
  if (!element.isAnnotationPresent(Profile.class)) {
   return true; // no-profiled changeset always matches
  }
  List<String> profiles = asList(element.getAnnotation(Profile.class).value());
  for (String profile : profiles) {
   if (profile != null && profile.length() > 0 && profile.charAt(0) == '!') {
    if (!activeProfiles.contains(profile.substring(1))) {
     return true;
    }
   } else if (activeProfiles.contains(profile)) {
    return true;
   }
  }
  return false;
 }
}

代码示例来源:origin: mongobee/mongobee

private boolean matchesActiveSpringProfile(AnnotatedElement element) {
 if (!ClassUtils.isPresent("org.springframework.context.annotation.Profile", null)) {
  return true;
 }
 if (!element.isAnnotationPresent(Profile.class)) {
  return true; // no-profiled changeset always matches
 }
 List<String> profiles = asList(element.getAnnotation(Profile.class).value());
 for (String profile : profiles) {
  if (profile != null && profile.length() > 0 && profile.charAt(0) == '!') {
   if (!activeProfiles.contains(profile.substring(1))) {
    return true;
   }
  } else if (activeProfiles.contains(profile)) {
   return true;
  }
 }
 return false;
}

代码示例来源:origin: com.github.mongobee/mongobee

private boolean matchesActiveSpringProfile(AnnotatedElement element) {
 if (!ClassUtils.isPresent("org.springframework.context.annotation.Profile", null)) {
  return true;
 }
 if (!element.isAnnotationPresent(Profile.class)) {
  return true; // no-profiled changeset always matches
 }
 List<String> profiles = asList(element.getAnnotation(Profile.class).value());
 for (String profile : profiles) {
  if (profile != null && profile.length() > 0 && profile.charAt(0) == '!') {
   if (!activeProfiles.contains(profile.substring(1))) {
    return true;
   }
  } else if (activeProfiles.contains(profile)) {
   return true;
  }
 }
 return false;
}

相关文章