spring 获取context单例

	private static ApplicationContext context;
	
	public static  void initContext(){
		context = new ClassPathXmlApplicationContext( "classpath*:config/spring/*.xml");
	}
	
	public static ApplicationContext getContext(){
		if(context==null)
			initContext();
		return context;
	}

 

你可能感兴趣的:(context)