在配置文件里面就是yml或者properties结尾的文件里加上这一句 jpa: properties: hibernate: enable_lazy_load_no_trans: true 这是yml的配置文件,如果是properties可以使用点代替: