package io.gisbi.listener;


import io.gisbi.utils.ConfigUtils;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;

public class EhCacheStartListener implements ApplicationContextInitializer<ConfigurableApplicationContext> {
    @Override
    public void initialize(ConfigurableApplicationContext applicationContext) {
        String property = applicationContext.getEnvironment().getProperty("gisbi.login_timeout", String.class, "480");
        System.setProperty("gisbi.login_timeout", property);

        String ehcache = ConfigUtils.getConfig("gisbi.path.ehcache", "/opt/gisbi2.0/cache");
        System.setProperty("gisbi.path.ehcache", ehcache);
    }
}
