我往常写代码的时候.对于数据库我一直是在使用Mybatis,今天来尝试Jpa的时候,出现了一个问题,这个问题报错如下:
SpringBoot在使用Jpa的时候出现Caused by: java.lang.IllegalArgumentException: Not a managed type: class
当看到这个问题的时候还是很疑惑的
SpringBoot在使用Jpa的时候出现Caused by: java.lang.IllegalArgumentException: Not a managed type: class
这个错误翻译后是说:不是托管类型,当时想了下可能是因为没有扫描到这个类吧
,但是SpringBoot不是会挪描同包或者是子包嘛?

想到这里,因为我这个类所在的模块和SpringBoot的启动类没有在一个模块里面,所以我通过EntityScan注解的方式让SpringBoot启动的时候扫描一下,在SpringBoot启动类上加上这个注解[email protected](“这里面写上报错提示类的包名”)==
像下面这样,重新启动项目后,可以运行
SpringBoot在使用Jpa的时候出现Caused by: java.lang.IllegalArgumentException: Not a managed type: class

相关文章:

  • 2021-05-23
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-09-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2021-08-05
相关资源
相似解决方案