SpringBoot遇到的一些問題

2021-10-03 06:41:46 字數 1269 閱讀 8574

一、 找不到bean,提示required a bean of type '***' that could not be found.

錯誤資訊如下

***************************

***************************

description:

field judgeservice in com.demo.first.controller.judge.judgescontroller required a bean of type 'com.demo.first.dao.judge.judgeservice' that could not be found.

the injection point has the following annotations:

- @org.springframework.beans.factory.annotation.autowired(required=true)

action:

consider defining a bean of type 'com.demo.first.dao.judge.judgeservice' in your configuration.

可以看到 field judgeservice in com.demo.first.controller.judge.judgescontroller required a bean of type 'com.demo.first.dao.judge.judgeservice' that could not be found.

提示 judgeservice 在xx.xx.***.judgescontroller中找不到

########### controller 層#################

# 確實已經注入,進入下一層 service 層

@restcontroller

public class judgescontroller extends basecontrol

########### service 層#################

# service 層只是正常的介面,跳過,直接看實現層

########### serviceimpl 層#################

#發現是serviceimpl 未新增 @service,到此問題原因找到

@service

public class judgeserviceimpl implements judgeservice

SpringBoot 整合jpa遇到的一些問題

使用springboot整合jpa遇到一些問題,主要歸為如下幾點 1.啟動專案時,報錯 cannot determine embedded database driver class for database type none 2.controller方法中引數是bean型別,進行mock測試時不...

SpringBoot的一些註解

component 作用在類上,將物件交給容器管理 propertysource classpath book.properties 在類上引入其他配置 configurationproperties prefix book 類安全的屬性注入,指定配置字首 value 將屬性注入物件中 1.使用sp...

Spring Boot中的一些註解

參考 2 responsebody 3 controller 4 restcontroller 用於標註控制層元件,responsebody和 controller的合集。6 service 一般用於修飾service層的元件 7 repository 使用 repository註解可以確保dao或...