jUnit Spring
来源:互联网 发布:java三大框架是什么 编辑:程序博客网 时间:2024/05/14 04:35
一,配置Log4j及XML
新建JUnit4ClassRunner类。Junit代码如下:
- public class JUnit4ClassRunner extends SpringJUnit4ClassRunner {
- static {
- try {
- Log4jConfigurer.initLogging("classpath:com/config/log4j.properties");
- } catch (FileNotFoundException ex) {
- System.err.println("Cannot Initialize log4j");
- }
- }
- public JUnit4ClassRunner(Class<?> clazz) throws InitializationError {
- super(clazz);
- }
- }
- @RunWith(JUnit4ClassRunner.class)
- @ContextConfiguration(locations = "classpath:com/config/springConfig.xml")
- //@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/spring.xml","file:..."})
- @Transactional
- @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
- public class TestHibernate {
- ...
- }
二、Spring 中properties的加载
- <bean id="propertyConfigurer" class="com.canco.hibernate.util.CancoConnection">
- <property name="locations">
- <list>
- <value>file:WebRoot/WEB-INF/canco.properties</value>
- </list>
- </property>
- </bean>
引用 :http://blog.csdn.net/wangpeng047/article/details/20375413
http://blog.csdn.net/lancenero/article/details/7901373
0 0
- jUnit Spring
- Junit+Spring
- spring junit
- spring + junit
- spring&junit
- Spring*Junit
- Spring + Junit
- spring与junit
- JUnit 测试 Spring
- spring继承JUnit
- junit spring demo
- Spring Junit单元测试
- Spring + JUnit进行单元测试
- spring junit 测试
- 集成spring,hibernate4,junit
- spring junit完美解决方案
- spring junit 和mock
- Spring的Junit测试
- 传百度大脑将引进史上最重量级外援:Google Brain创始人
- HTTP服务响应和DownloadManager的使用
- 七步从Angular.JS菜鸟到专家(2):Scopes
- nginx 优化配置
- 再小的个体,也有自己品牌:通过微信公众平台,可以实现大量微信应用
- jUnit Spring
- [Bzoj1901]Zju2112 Dynamic Rankings
- 浅浅轻吟如花的芬芳,开始散漫着
- java总结输入流输出流
- Android framework系统默认设置修改
- C# 动态调用WebService
- 思科进一步扩展Videoscape平台云功能
- getElementByName()方法和getter属性,及与getElementById()的区别
- 学习:imfill