When I want to automatically import the SqlSession object in SpringBoot, the prompt is "null"

Viewed 17
public  class MapperTest {
    @Autowired
    private SqlSession sqlSession;
    @Test
    public void testMapper() throws Exception{
        SingerMapper mapper = sqlSession.getMapper(SingerMapper.class);
        List<Singer> singers = mapper.allSinger();

Ps:Although I know that I can directly inject the Singermapper to test, I still want to know how to use SQLSession to implement this~~

0 Answers
Related