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

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

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

瀏覽:107日期: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
主站蜘蛛池模板: 兴安盟| 靖宇县| 德令哈市| 大厂| 固原市| 台南市| 江西省| 西平县| 新郑市| 晋江市| 东乌珠穆沁旗| 西安市| 惠来县| 民和| 安阳市| 墨玉县| 河池市| 合作市| 郯城县| 武冈市| 丘北县| 民勤县| 德清县| 龙州县| 什邡市| 唐河县| 茶陵县| 印江| 汨罗市| 吉安市| 淮滨县| 西青区| 马尔康县| 宁陕县| 宜兴市| 成安县| 绍兴市| 含山县| 龙泉市| 泉州市| 孝义市|