在mapper.xml文件中的resultMap的type或者parameterType会用到自定义的POJO。

如果在 application.yml 中没有配置 mybatis.type-aliases-package 的话,就需要写全限定类名:

<select id="selectByStudentById" resultType="com.example.domain.Student">
     SELECT * FROM student WHERE id = 1
</select>

如果在 application.yml 中配置:

mybatis
  type-aliases-package: com.example.domain

那就可以直接写简称:

<select id="selectByStudentById" resultType="Student">
     SELECT * FROM student WHERE id = 1
</select>