private void prependProfile(ConfigurableEnvironment environment, String profile) {
   Set<String> profiles = new LinkedHashSet<String>();
   environment.getActiveProfiles(); // ensure they are initialized
   // But this one should go first (last wins in a property key clash)
   profiles.add(profile);
   profiles.addAll(Arrays.asList(environment.getActiveProfiles()));
   environment.setActiveProfiles(profiles.toArray(new String[profiles.size()]));
 }
 private String getApplicationId(ConfigurableEnvironment environment) {
   String name = environment.resolvePlaceholders(this.name);
   String index = environment.resolvePlaceholders(INDEX_PATTERN);
   String profiles = StringUtils.arrayToCommaDelimitedString(environment.getActiveProfiles());
   if (StringUtils.hasText(profiles)) {
     name = name + ":" + profiles;
   }
   if (!"null".equals(index)) {
     name = name + ":" + index;
   }
   return name;
 }