如何使用Junit测试使用Spring框架的代码

2025-04-14 20:16:40
推荐回答(1个)
回答1:

在before里面,通过xml文件加载context,new ClassPathApplicationContext(xml配置文件path)
在test主体里面,通过context获取测试类
在after里面,销毁context