当前位置:网站首页>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-存入的数据类型
边栏推荐
- Ambiguous method call.both
- STM32 problem collection
- Implementation of a sequence table
- Why SocialFi achievement Web3 decentralized social in the future
- els 方块向右移
- 【CocosCreator 3.5】CocosCreator get network status
- IDEA comment report red solution
- 品牌广告投放平台的中台化应用与实践
- 选好冒烟测试用例,为进入QA的制品包把好第一道关
- Chapter 9 SVM Practice
猜你喜欢
SIP Protocol Standard and Implementation Mechanism
Office automation case: how to automatically generate period data?
[C language] Three-pointed chess (classic solution + list diagram)
刚出道“一战成名”,安全、舒适一个不落
Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢
What skills do I need to learn to move from manual testing to automated testing?
How to develop a high-quality test case?
Addition and Subtraction of Scores in LeetCode Medium Questions
TCP详解(三)
IDEA 注释报红解决
随机推荐
数据库实现分布式锁
Moxa NPort device flaw could expose critical infrastructure to devastating attack
els 方块向右移动边界判断、向下加速
Good place to download jar packages
TCP详解(一)
Ambiguous method call.both
return in try-catch
The distance value between two arrays of LeetCode simple questions
Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢
SocialFi 何以成就 Web3 去中心化社交未来
What is distributed and clustered?What is the difference?
With 7 years of experience, how can functional test engineers improve their abilities step by step?
浅识Flutter 基本组件之showDatePicker方法
Mysql 45 study notes (twenty-five) MYSQL guarantees high availability
【Cocos Creator 3.5】缓动系统停止所有动画
LeetCode中等题之分数加减运算
[Android] Room - Alternative to SQLite
What is a distributed lock?Three ways of implementing distributed lock
IDEA 注释报红解决
SQALE 是什么