当我将存储库与 h2 数据库一起使用时出现 Spring boot 错误

问题描述 投票:0回答:1
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'studentController': Unsatisfied dependency expressed through field 'studentService': Error creating bean with name 'studentService': Unsatisfied dependency expressed through field 'studentRepository': Error creating bean with name 'studentRepository' defined in com.example.demo.repository.StudentRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration:...


我在网上尝试了很多解决方案,并按照许多教程中的所有说明进行了操作,但我总是遇到此错误。当我评论存储库界面时它消失了。我正在关注这个 https://www.javatpoint.com/spring-boot-h2-database 我把所有依赖项都放在了 h2 和 jps 和 web

spring-boot spring-security spring-data-jpa spring-data h2
1个回答
0
投票

尝试在repository接口上添加@Repository注解,spring boot无法将StudentRepository识别为bean

© www.soinside.com 2019 - 2024. All rights reserved.