解决springboot整合jpa启动类报错:Not a managed type: class com.example.entity.Xxx

报错信息:

Error creating bean with name 'userRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Not a managed type: class com.example.entity.User

Caused by: java.lang.IllegalArgumentException: Not a managed type: class com.example.entity.User

 解决方案:

  1. 检查被使用的对应类上是否添加@Entity注解,和生成表的注解及相关属性注解。
  2. 如果不是1方案的问题,可以在启动类中添加扫描使用类所在包的注解@EntityScan(basePackages = “com.example.entity”)试试

相关推荐

  1. SpringBoot 3.2.1中使用JPA

    2024-07-15 17:38:04       64 阅读
  2. SpringBoot 整合 JPA:实战指南

    2024-07-15 17:38:04       58 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-15 17:38:04       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-15 17:38:04       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-15 17:38:04       58 阅读
  4. Python语言-面向对象

    2024-07-15 17:38:04       69 阅读

热门阅读

  1. Redis① —— Redis基础

    2024-07-15 17:38:04       20 阅读
  2. LeetCode 445.两数相加||

    2024-07-15 17:38:04       16 阅读
  3. openstack

    2024-07-15 17:38:04       19 阅读
  4. Memcached与Redis:缓存解决方案的较量与选择

    2024-07-15 17:38:04       21 阅读
  5. pandas读取超过16位的excle

    2024-07-15 17:38:04       16 阅读
  6. blinker库

    2024-07-15 17:38:04       19 阅读
  7. 如何使用断点续传方式上传大文件到阿里云 OSS

    2024-07-15 17:38:04       14 阅读
  8. Web打点技术的攻击手段和渗透测试工具

    2024-07-15 17:38:04       20 阅读
  9. 游戏开发面试题2

    2024-07-15 17:38:04       18 阅读
  10. linux系统调用

    2024-07-15 17:38:04       21 阅读
  11. git安装

    git安装

    2024-07-15 17:38:04      19 阅读
  12. 2# 监控都不管用

    2024-07-15 17:38:04       16 阅读
  13. 线程同步的使用(二)

    2024-07-15 17:38:04       17 阅读
  14. 了解动力转向油封

    2024-07-15 17:38:04       17 阅读