当前位置:网站首页>No qualifying bean of type question
No qualifying bean of type question
2022-07-31 03:33:00 【UlricaQ】
Article table of contents
No qualifying bean of type problem solving ideas
To solve the problem of No qualifying bean of type, there are currently two reasons for the error:
- Annotations
- Configuration (scanning packages, nacos, class names, etc.)
1. Comments
- Check if the annotations corresponding to controller, service and mapper are correct
- Such as: @Controller @Service @Component @Repository
2. Configuration
1. Configure whether nacos is used, and you need to configure database information, etc.
2. Whether the scan package is used
or use @MapperScan(value="com.*** ")
Annotation Extension
- what: special tag in code
- where: can be placed on a method or a class
1. How does the front-end code link use annotations?
- If the annotation is on the method, you can write the annotation of the method in the link
- If the annotation is on the class, you need to write the annotation of the class + method in the link
2. Annotation attribute:
- path: Specifies the requested URL
- (commonly used) value has the same function as path, you can add a path, use value can be omitted, just write the path directly
- (commonly used) method: specify the request method of this method
- headers: Specify conditions to limit request headers-
- params: conditions for restricting request parameters
– the key and value are the same
– case 1: only limit the parameters passed, not what the parameters are specific
– case 2: the parameters must be consistent
3. Common Notes
@RequestParam
- Role: Assign the parameter with the specified name in the request to the formal parameter in the controller
- Attribute:
–value: parameter name
–required: whether this parameter must be filled in - Example
@RequestBody
- Role: used to get the content of the request body
- Attribute: required
- Scope: Asynchronous (used when asynchronous)
- Example
@PathVariable
- Function: placeholder for binding url
- Benefits: restful programming style
- The original way – add the root path to each path
- restful method: use get, post, put to distinguish the path
–localhost:8080/user/10 get——this is the http request indicating that the request method is get and the parameter id
@RequestHeader: not commonly used
@CookieValue
- Role: Pass the value of the specified cookie name into the controller method parameter
@ModelAttribute
- Function: Modify methods and parameters
- how: This modification is executed first
@SessionAttributes
- Function: used for parameter sharing between multiple execution controller methods
- attributes
–value
–type-stored data type
边栏推荐
猜你喜欢
[C language] General method for finding the sum of the greatest common factor and the least common multiple of two integers m and n, the classical solution
MP使用时的几个常见报错
BP神经网络
数据库实现分布式锁
Just debuted "Fight to Fame", safety and comfort are not lost
[C language] Preprocessing operation
Web container and IIS --- Middleware penetration method 1
端口排查步骤-7680端口分析-Dosvc服务
[Dynamic programming] Maximum sum of consecutive subarrays
$attrs/$listeners
随机推荐
TCP详解(一)
Database implements distributed locks
【Exception】The field file exceeds its maximum permitted size of 1048576 bytes.
【HCIP】ISIS
STM32 problem collection
[C language] Three-pointed chess (classic solution + list diagram)
Atomic operation CAS
CloudCompare&PCL 计算两个点云之间的重叠度
Redis counts new and retained users
A brief introduction to the CheckboxListTile component of the basic components of Flutter
STM32问题合集
Redis uses sorted set to cache latest comments
Detailed explanation of TCP (2)
Detailed explanation of TCP and UDP
els 方块向左移动条件判断
some of my own thoughts
Key Technologies of Interface Testing
大小端模式
LeetCode simple problem to find the subsequence of length K with the largest sum
The distance value between two arrays of LeetCode simple questions