【发布时间】:2021-12-26 06:45:57
【问题描述】:
我是 Spring Boot 的新手,但目前正在构建一个应用程序,该应用程序使用 Spring 不是为了它的 web 应用程序功能,而是利用它的数据源功能(使用 JPA 注释)。运行我的代码时,出现以下编译错误:
21-11-14 18:12:17.765 ERROR 13432 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'taskSerializableInteractor' defined in file [/Users/myname/softwarename/target/classes/api/TaskSerializableInteractor.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'taskSerializableRepository' defined in api.TaskSerializableRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class api.TaskSerializable
此错误向我表明 Spring Boot 在处理应用程序 API 类中定义的依赖注入时存在一些问题。项目本身相当大,我不知道这里调试需要哪些代码,但如果需要,我很乐意发布 sn-ps。我已经用谷歌搜索了几个小时,不知道如何解决这个问题。有关如何解决此错误的任何提示?
【问题讨论】:
-
您能否展示一下TaskSerializable 类以及它是如何通过您的TaskSerializableRepository 引用的:)
标签: java spring database spring-boot jpa