juint测试注解

来源:互联网 发布:sql语句基础教程 编辑:程序博客网 时间:2024/05/16 02:46

创建一个juint类 :

import org.junit.Test;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.test.context.ContextConfiguration;import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;import com.zm.model.CfProject;import com.zm.service.ProjectService;@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations={"classpath:spring-common.xml","classpath:spring-transaction.xml"})public class juint { @Autowired private ProjectService projectService;  @Test public void test(){  System.out.println("注入service:"+projectService);  CfProject queryProById = projectService.queryProById("62");  System.out.println(queryProById); }}







原创粉丝点击