⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 springcontexttests.java

📁 JEECMS是JavaEE版网站管理系统(Java Enterprise Edition Content Manage System)的简称。 基于java技术开发
💻 JAVA
字号:
package com.ponyjava.common.test;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public abstract class SpringContextTests {
	private static ApplicationContext context;

	protected final Logger logger = LoggerFactory.getLogger(this.getClass());

	public synchronized ApplicationContext getContext() {
		if (context == null) {
			context = new ClassPathXmlApplicationContext(getConfigLocations());
		}
		return context;
	}

	public Object getBean(String name) {
		return getContext().getBean(name);
	}

	protected String[] getConfigLocations() {
		String[] config = new String[] { "test-applicationContext.xml", };
		return config;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -