package com.uniclues.anjian.config;
import java.util.Objects;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.springframework.context.ApplicationContext;
public class WebXMLConfig {//模拟web工程加载spring配置
private static ApplicationContext actx = null;
private static volatile WebXMLConfig webXMLConfig = null;
public ApplicationContext getActx() {
return actx;
}
private static String[] args = new String[] { "classpath*:/META-INF/applicationContext*.xml" };
private WebXMLConfig() {
}
public static WebXMLConfig getWebXmlInstance() {
if (Objects.isNull(webXMLConfig)) {
synchronized (WebXMLConfig.class) {
if (Objects.isNull(webXMLConfig)) {
actx = new ClassPathXmlApplicationContext(args);
webXMLConfig = new WebXMLConfig();
}
}
}
return webXMLConfig;
}
}