package com.netflix.evcache.util;


import javax.inject.Inject;

import com.netflix.archaius.DefaultPropertyFactory;
import com.netflix.archaius.api.PropertyRepository;
import com.netflix.archaius.config.DefaultSettableConfig;
public class EVCacheConfig {

    private static EVCacheConfig INSTANCE;

    /**
     * This is an hack, should find a better way to do this 
     **/
    private static PropertyRepository propertyRepository;

	@Inject
    public EVCacheConfig(PropertyRepository repository) {
        propertyRepository = repository;
        INSTANCE = this;
    }

    private EVCacheConfig() {
        this(new DefaultPropertyFactory(new DefaultSettableConfig()));
        System.err.println("\n\nNon Standard way of initializing EVCache. Creating an instance PropertyRepository in a non standard way. Please Inject EVCache.Builder\n\n");
    }

    public static EVCacheConfig getInstance() {
        if(INSTANCE == null) new EVCacheConfig();
        return INSTANCE;
    }

    public PropertyRepository getPropertyRepository() {
    	return propertyRepository;
    }

    public static void setPropertyRepository(PropertyRepository repository) {
        propertyRepository = repository;
    }

}

@@ -194,30 +194,190 @@
 ius.
-config.DefaultSettable
+api.config.CompositeConfig;%0Aimport com.netflix.archaius.config.DefaultCompositeConfig;%0Aimport com.netflix.archaius.config.EnvironmentConfig;%0Aimport com.netflix.archaius.config.System
 Conf
@@ -662,124 +662,333 @@
 ) %7B%0A
+%09
     
-    propertyRepository = repository
+if(repository == null) %7B%0A%09        try %7B%0A    %09        final CompositeConfig applicationConfig = new DefaultCompositeConfig()
 ;%0A    
+%09 
     
-INSTANCE = this;%0A    %7D%0A%0A    private EVCacheConfig() %7B%0A        this(
+   applicationConfig.addConfig(%22SYSTEM%22, SystemConfig.INSTANCE);%0A    %09        applicationConfig.addConfig(%22ENVIRONMENT%22,  EnvironmentConfig.INSTANCE);%0A    %09        propertyRepository = 
 new 
@@ -1014,47 +1014,37 @@
 ory(
-new DefaultSettable
+application
 Config
-())
 );%0A
+%09
         
 Syst
@@ -1043,171 +1043,314 @@
     
-System.err.println(%22%5Cn%5CnNon Standard way of initializing EVCache. Creating an instance PropertyRepository in a non standard way. Please Inject EVCache.Builder%5Cn%5Cn%22
+%7D catch (Exception e) %7B%0A%09            e.printStackTrace();%0A%09            propertyRepository = new DefaultPropertyFactory(new DefaultCompositeConfig());%0A            %7D%0A%09    %7D else %7B%0A%09        propertyRepository = repository;%0A%09    %7D%0A        INSTANCE = this;%0A    %7D%0A%0A    private EVCacheConfig() %7B%0A        this(null
 );%0A 
@@ -1347,32 +1347,33 @@
 s(null);%0A    %7D%0A%0A
+%0A
     public stati

Support for SystemConfig and EnvConfig when not using DI