当前位置:网站首页>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-存入的数据类型
边栏推荐
- MultipartFile文件上传
- LeetCode每日一练 —— 138. 复制带随机指针的链表
- SIP Protocol Standard and Implementation Mechanism
- LeetCode中等题之分数加减运算
- 【C语言】三子棋(经典解法+一览图)
- [Godot][GDScript] 二维洞穴地图随机生成
- LeetCode每日一练 —— OR36 链表的回文结构
- [C language foundation] Solve C language error: expected ';', ',' or ')' before '&' token
- 分布式锁以及实现方式三种
- 学习DAVID数据库(1)
猜你喜欢

The application and practice of mid-to-platform brand advertising platform

【异常】The field file exceeds its maximum permitted size of 1048576 bytes.

【C语言】三子棋(经典解法+一览图)

5. How does the SAP ABAP OData service support the $filter operation

SQL injection Less54 (limited number of SQL injection + union injection)

Addition and Subtraction of Scores in LeetCode Medium Questions

TCP详解(三)

Database implements distributed locks

IDEA 注释报红解决

LeetCode简单题之两个数组间的距离值
随机推荐
Map.Entry理解和应用
CloudCompare & PCL calculate the degree of overlap between two point clouds
els block to the right
SIP Protocol Standard and Implementation Mechanism
The application and practice of mid-to-platform brand advertising platform
Thesis framework of the opening report
What is SQALE
Point Cloud DBSCAN Clustering (MATLAB, not built-in function)
IDEA comment report red solution
IIR filter and FIR filter
[Godot][GDScript] 2D cave map randomly generated
Crypto Firms Offer Offer To Theft Hackers: Keep A Little, Give The Rest
postgresql 15源码浅析(5)—— pg_control
Detailed explanation of TCP (2)
Redis实现分布式锁
Redis implements distributed locks
Mysql 45讲学习笔记(二十五)MYSQL保证高可用
Atomic operation CAS
2022 Nioke Multi-School League Game 4 Solution
What skills do I need to learn to move from manual testing to automated testing?
