JUnit单元测试用例获取ApplicationContext实例的方法

public class TPlatformInfoTest extends TestBase{
    
    private static MyHttpClient TPlatformInfoDispose;
    
    @BeforeClass
    public static void setUpBeforeClass(){
        System.out.println("***********here init first***************");
        TPlatformInfoDispose = new MyHttpClient("platform");
        DataSourceContextHolder.setDbType("ds2");
        ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:WEB-INF/rest-*.xml");
        pfm = ctx.getBean(TPlatformInfoMapper.class);
        dim = ctx.getBean(TDeviceInfoMapper.class);
    }
复制代码

猜你喜欢

转载自www.cnblogs.com/lcxdevelop/p/8946198.html