Spring与Junit测试整合
2024-08-31 01:07:40
一、引入spring测试包:text包
二、@RunWith:指定spring对junit提供的一个运行器
@ContextConfiguration: locations指定spring配置文件位置
1 @RunWith(SpringJUnit4ClassRunner.class)
2 @ContextConfiguration(locations={"classpath:ApplicationContext.xml"})
3 public class TestSpring1 {
4 @Autowired
5 private PersonService ps;
6 @Test
7 public void test1(){
8 ps.savePerson();
9 }
10 }
最新文章
- 数据库大数据处理---复制(SQLServer)
- RabbitMQ消息队列1: Detailed Introduction 详细介绍
- POJ3154 Graveyard
- yum Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
- 【2016-08-21】Linux内核版本编号规则简介
- BZOJ 1833 count 数字计数
- jQuery.Cookie.js用法
- Mac OS 快捷键
- TcxDBTreeList导出EXCEL
- 网站WAF的检测
- ORA-00933 UNION 与 ORDER BY
- 美丽的for循环语句
- 【Hibernate】双向多对多Set查询
- Python之路-基本数据类型
- list与Set、Map区别
- vector数组中STL习惯性用法
- spring security4.2.2的maven配置+spring-security配置详解+java源码+数据库设计
- 【JS】【3】标签显示几秒后自动隐藏
- awk使用教程
- leetcode解题报告 32. Longest Valid Parentheses 动态规划DP解