国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

java - spring boot不能注入JpaRepository接口,提示找不到bean

瀏覽:130日期:2023-11-04 14:09:58

問題描述

Field studentRepository in com.example.demo.StudentController required a bean of type ’com.example.demo.StudentRepository’ that could not be found.

Action:

Consider defining a bean of type ’com.example.demo.StudentRepository’ in your configuration.

@RestControllerpublic class StudentController { @Autowired private StudentRepository studentRepository; @GetMapping(value = '/findAll') public List<Student> studentList(){return studentRepository.findAll(); }}

StudentRepository 繼承 JpaRepository,應該是個最簡單的例子了

一共就一個包,SpringBootApplication和Controller都放在一個包下面,應該不會出現網上的順序的問題

問題解答

回答1:

StudentRepository 沒有注冊

回答2:

我自己解決了,jpa的包沖突了。

標簽: java
主站蜘蛛池模板: 松滋市| 苗栗县| 广安市| 彰化县| 民县| 乌拉特后旗| 井冈山市| 友谊县| 那坡县| 姚安县| 鄂温| 新余市| 大余县| 兖州市| 肇源县| 阜平县| 阿坝县| 南召县| 芮城县| 屯留县| 泾源县| 丰城市| 高邮市| 车致| 兴化市| 宁城县| 兴化市| 运城市| 探索| 承德县| 中牟县| 台前县| 江津市| 泗水县| 河间市| 四会市| 左云县| 江达县| 汪清县| 密山市| 霍邱县|