SpringBoot-provider-JPA Not a managed type 问题分析及解决办法

spring boot jpa-java.lang.IllegalArgumentException: Not a managed type异常问题解决方法




JPA实体类没有被扫描到,导致这样的情况有以下几种可能


1        实体类没有加上@Entity注解


        对应解决方法在实体类上加上@Entity即可解决问题


2        没有按照SpringBoot的约定,默认扫描(application.java 入口类相对的兄弟包及其子包)


        2.1        将application.java(入口类)放置到更高层级的包,使得项目结构符合SpringBoot约定扫描的规则


        2.2        在启动类中添加扫描注解


                2.2.1        @ComponentScan(basePackages = "com.boot.demo.xxx.*.*")


                                用于扫描@Controller @Service


                2.2.2        @EnableJpaRepositories(basePackages = "com.boot.demo.xxx.*.dao") 


                                用于扫描Dao @Repository


                2.2.3        @EntityScan("com.boot.demo.xxx.*.*")


                                用于扫描JPA实体类 @Entity




原文地址:https://blog.csdn.net/heyewu4107/article/details/78942393
原文地址:https://www.cnblogs.com/jpfss/p/11126810.html