单元测试,@Resource无法注入
解决代码 测试类的写法:
@RunWith(SpringRunner.class) @SpringBootTest(classes = {LreApplication.class}) public class Line { @Resource private GanSuComputeImpl ganSuCompute; @Resource private ProjectService projectService; @Test public void testComputeLine() { String projectName = projectService.getProjectName(); System.out.println(projectName); }