*/
public class BaseTest
{
/* Spring的应用上下文 */
protected ApplicationContext ac;
/**
* 初始化
*/
@Before
public void init()
{
/**
* ClassPathXmlApplicationContext:默认只会从所在的项目中找配置文件
* classpath*:表示从所有的Classpath中寻找配置文件,包含JAR包
*/
/*ac = new ClassPathXmlApplicationContext("classpath*:spring/applicationContext_*.xml");*/
ac = new ClassPathXmlApplicationContext("classpath*:META-INF/spring/applicationContext_*.xml");
ConstatFinalUtil.SYS_LOGGER.info("--init--ac:{}", ac);
}
/**
* 测试
*/
@Test
public void test()
{
ConstatFinalUtil.SYS_LOGGER.info("--test--");
}
/**
* 关闭
*/
@After
public void close()
{
ConstatFinalUtil.SYS_LOGGER.info("--close--");
if (this.ac instanceof ClassPathXmlApplicationContext)
{
ClassPathXmlApplicationContext cpxac = (ClassPathXmlApplicationContext) this.ac;
cpxac.close();
}
}
}