当前位置:网站首页>No qualifying bean of type 问题
No qualifying bean of type 问题
2022-07-31 03:19:00 【UlricaQ】
No qualifying bean of type 问题解决思路
解决 No qualifying bean of type 问题,目前遇到过两种导致错误的原因:
- 注解
- 配置(扫描包,nacos,类名等)
1、注解
- 检查controller,service,mapper对应的注解是否正确
- 如:@Controller @Service @Component @Repository
2、配置
1、配置是否使用了nacos,需要配置数据库信息等。
2、扫描包是否用到
或者使用了@MapperScan(value="com.*** ")
注解扩展
- what:代码里的特殊标记
- where:可以放在方法上,也可以放在类上
1、前端代码 链接是如何使用注解的?
- 如果注解放在方法上,链接中写方法的注解即可
- 如果注解放在类上,链接中需要写类+方法的注解
2、注解属性:
- path:指定请求的URL
- (常用)value和path功能一样,都可以加路径,使用value可省略,直接写路径即可
- (常用)method:指定该方法的请求方式
- headers:指定限制请求消息头的条件-
- params:限制请求参数的条件
– key和value值一样
–情况1:只限制传参,不限制参数是具体的什么
–情况2:参数必须一致
3、常用注解
@RequestParam
- 作用:把请求中指定名称的参数给控制器中的形参赋值
- 属性:
–value:参数名称
–required:是否必须填此参数 - 例子
@RequestBody
- 作用:用于获得请求体内容
- 属性:required
- 作用域:异步(异步时会用到)
- 例子
@PathVariable
- 作用:绑定url的占位符
- 优点:restful编程风格
- 原来的方式–每一个路径都要添加根路径
- restful方式:用get、post、put区别开路径
–localhost:8080/user/10 get——这就是表明请求方式为get并带id这个参数的http请求
@RequestHeader:不常用
@CookieValue
- 作用:把指定cookie名称的值传入控制器方法参数
@ModelAttribute
- 作用:修饰方法和参数
- how:该修饰先执行
@SessionAttributes
- 作用:用于多次执行控制器方法间的参数共享
- 属性
–value
–type-存入的数据类型
边栏推荐
- 【Exception】The field file exceeds its maximum permitted size of 1048576 bytes.
- SocialFi 何以成就 Web3 去中心化社交未来
- IDEA comment report red solution
- Is interprofessional examination difficult?Low success rate of "going ashore"?Please accept this practical guide!
- The Map Entry understanding and application
- STM32问题合集
- 点云DBSCAN聚类(MATLAB,非内置函数)
- SIP协议标准和实现机制
- postgresql 15源码浅析(5)—— pg_control
- C primer plus学习笔记 —— 8、结构体
猜你喜欢
A brief introduction to the CheckBox component of the basic components of Flutter
postgresql 15源码浅析(5)—— pg_control
5. SAP ABAP OData 服务如何支持 $filter (过滤)操作
分布式系统架构需要解决的问题
Mysql 45 study notes (23) How does MYSQL ensure that data is not lost
【Exception】The field file exceeds its maximum permitted size of 1048576 bytes.
TCP详解(二)
Chapter 9 SVM Practice
CefSharp入门-winform
【C语言】预处理操作
随机推荐
With 7 years of experience, how can functional test engineers improve their abilities step by step?
浅识Flutter 基本组件之CheckboxListTile组件
LeetCode simple problem to find the subsequence of length K with the largest sum
QML的使用
web容器及IIS --- 中间件渗透方法1
IIR filter and FIR filter
5. How does the SAP ABAP OData service support the $filter operation
IDEA comment report red solution
C# remote debugging
浅识Flutter 基本组件之CheckBox组件
【HCIP】ISIS
CefSharp入门-winform
Observer pattern
STM32问题合集
IDEA 注释报红解决
addressable in Golang
TCP/IP four-layer model
立足本土,链接全球 | 施耐德电气“工业SI同盟”携手伙伴共赴未来工业
Graphical lower_bound & upper_bound
LeetCode中等题之分数加减运算