@RunWith(SpringRunner.class)@SpringBootTest(classes = App.class)// 就是你springboot的启动类public class IUserServiceTest { @Autowired private IUserService userService; @Test public void getById() { System.out.println(userService.getById(6L)); }}