码迷,mamicode.com
首页 > 编程语言 > 详细

SpringJunit4测试

时间:2018-01-28 19:13:14      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:blog   path   date   com   配置   分享图片   time   sys   classpath   

前段时间工作中遇到了,所以就简单学习了一下,只学到了点皮毛,

1.测试类

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
public class SpringJunit4test
{
@Resource
Date date;
@Test
public void testas()
{
System.out.println(date.getTime());
}

@Autowired
ApplicationContext ctx;

@Test
public void testbb() throws Exception
{
DaoBean db = ctx.getBean(DaoBean.class);
db.show();
}

}

2.DaoBean 

技术分享图片

 

3.XML配置

技术分享图片

 

SpringJunit4测试

标签:blog   path   date   com   配置   分享图片   time   sys   classpath   

原文地址:https://www.cnblogs.com/zssw1990/p/8371811.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!