springboottest测试依赖和使用


    org.springframework.boot
    spring-boot-starter-test

//然后创建测试类,注意加运行启动注解,和springbootest注解

@RunWith(SpringRunner.class)
@SpringBootTest
public class User01MapperTest {

    @Autowired
    User01Mapper user01Mapper;

    @Test
    public void testQuery(){
        User01 user = user01Mapper.selectByPrimaryKey("张三");
        System.out.println(user);
    }
}

领取springboot完整demo和架构基础demo,加群79367637

你可能感兴趣的:(springboot)