/** @param containerAttributes */
 private void setConfiguredContainerAttributes(ContainerAttributes containerAttributes) {
   Map<String, String> attributes = new HashMap<String, String>();
   for (PropertySource<?> propertySource : environment.getPropertySources()) {
     if (propertySource instanceof EnumerablePropertySource) {
       EnumerablePropertySource<?> ps = (EnumerablePropertySource<?>) propertySource;
       for (String key : ps.getPropertyNames()) {
         if (key.startsWith(CONTAINER_ATTRIBUTES_PREFIX)) {
           String attributeKey = key.replaceAll(CONTAINER_ATTRIBUTES_PREFIX, "");
           attributes.put(attributeKey, environment.getProperty(key));
         }
       }
     }
   }
   containerAttributes.putAll(attributes);
 }
  /**
   * Wrap the module options property source so that it can be the only one living in the
   * environment. This will delegate to the parent environment ONLY IF the key is not a known module
   * option name.
   */
  private PropertySource<?> wrap(final EnumerablePropertySource<?> moduleOptionsPropertySource) {
    return new PropertySource<Object>(
        moduleOptionsPropertySource.getName(), moduleOptionsPropertySource) {

      @Override
      public Object getProperty(String name) {
        // Resolve thru the module first
        Object result = moduleOptionsPropertySource.getProperty(name);
        if (result != null) {
          return result;
        }
        // If module could not resolve, but it is *known* to be
        // a valid module option name, do NOT delegate to the env
        // as it could end up in false positives
        if (moduleOptionsPropertySource.containsProperty(name)) {
          return null;
        } else {
          return parent == null ? null : parent.getProperty(name);
        }
      }
    };
  }