@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)); }}