juint测试注解

创建一个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);
 }
}







猜你喜欢

转载自blog.csdn.net/m0_37392489/article/details/77683955