?? springcontexttests.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 log = 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 + -