org.springframework.core.env.Environment#getActiveProfiles ( )源码实例Demo

下面列出了org.springframework.core.env.Environment#getActiveProfiles ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spring-cloud-gcp   文件: GcpConfigProperties.java
@Override
public void setEnvironment(Environment environment) {
	if (this.profile == null) {
		String[] profiles = environment.getActiveProfiles();
		if (profiles.length == 0) {
			profiles = environment.getDefaultProfiles();
		}

		if (profiles.length > 0) {
			this.profile = profiles[profiles.length - 1];
		}
		else {
			this.profile = "default";
		}
	}
}
 
源代码2 项目: flair-registry   文件: DefaultProfileUtil.java
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
源代码3 项目: flair-engine   文件: DefaultProfileUtil.java
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
private boolean hasKubernetesProfile(Environment environment) {
    for (String activeProfile : environment.getActiveProfiles()) {
        if (KUBERNETES_PROFILE.equalsIgnoreCase(activeProfile)) {
            return true;
        }
    }
    return false;
}
 
源代码5 项目: cubeai   文件: DefaultProfileUtil.java
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
源代码6 项目: cubeai   文件: DefaultProfileUtil.java
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
源代码7 项目: cubeai   文件: DefaultProfileUtil.java
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
源代码8 项目: Cheddar   文件: RuntimeConfiguration.java
public static boolean isDeployedEnvironment(final Environment environment) {
    for (final String profile : environment.getActiveProfiles()) {
        if (profile.equalsIgnoreCase(CI_PROFILE) || profile.equalsIgnoreCase(UAT_PROFILE)
                || profile.equalsIgnoreCase(PRODUCTION_PROFILE)) {
            return true;
        }
    }
    return false;
}
 
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
源代码11 项目: albedo   文件: DefaultProfileUtil.java
/**
 * Get the profiles that are applied else get default profiles.
 */
public static String[] getActiveProfiles(Environment env) {
	String[] profiles = env.getActiveProfiles();
	if (profiles.length == 0) {
		return env.getDefaultProfiles();
	}
	return profiles;
}
 
@Bean
public CommandLineRunner writeData(FileWriterGateway gateway, Environment env) {
  return args -> {
    String[] activeProfiles = env.getActiveProfiles();
    if (activeProfiles.length > 0) {
      String profile = activeProfiles[0];
      gateway.writeToFile("simple.txt", "Hello, Spring Integration! (" + profile + ")");
    } else {
      System.out.println("No active profile set. Should set active profile to one of xmlconfig, javaconfig, or javadsl.");
    }
  };
}
 
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
源代码14 项目: ehcache3-samples   文件: DefaultProfileUtil.java
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
源代码15 项目: tutorials   文件: DefaultProfileUtil.java
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
源代码16 项目: tutorials   文件: DefaultProfileUtil.java
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
public ConfigClientProperties(Environment environment) {
	String[] profiles = environment.getActiveProfiles();
	if (profiles.length == 0) {
		profiles = environment.getDefaultProfiles();
	}
	this.setProfile(StringUtils.arrayToCommaDelimitedString(profiles));
}
 
/**
 * Get the profiles that are applied else get default profiles.
 *
 * @param env spring environment
 * @return profiles
 */
public static String[] getActiveProfiles(Environment env) {
    String[] profiles = env.getActiveProfiles();
    if (profiles.length == 0) {
        return env.getDefaultProfiles();
    }
    return profiles;
}
 
源代码20 项目: spring-boot-seed   文件: ProjectProperties.java
@Autowired
public ProjectProperties(Environment environment) {
    this.environment = environment;
    this.env = environment.getActiveProfiles();
}