如何判断SpringMVC.xml是否被加载进来 50
基于Spring和Junit4测试中,在不启动tomcat的情况下,想获取springMVC.xml里的Bean信息,可是目前无法判断是否都进来context文件了!代码...
基于Spring和Junit4测试中,在不启动tomcat的情况下,想获取springMVC.xml里的 Bean信息,可是目前无法判断是否都进来context文件了! 代码如下
@RunWith(value = SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:applicationContext/springMVC.xml"
,"classpath*:META-INF/context.xml"})
public class JDBCConnectionPoolTestForSpring extends TestCase {
@Autowired
protected ApplicationContext ctx;
@Test
public void testCreateInstance002() throws PhoenixException {
this.ctx.getBean("dataSource",DataSource.class);
JDBCConnectionPool.createInstance();
} 展开
@RunWith(value = SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:applicationContext/springMVC.xml"
,"classpath*:META-INF/context.xml"})
public class JDBCConnectionPoolTestForSpring extends TestCase {
@Autowired
protected ApplicationContext ctx;
@Test
public void testCreateInstance002() throws PhoenixException {
this.ctx.getBean("dataSource",DataSource.class);
JDBCConnectionPool.createInstance();
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询