In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail "SpringBoot scan can not Controller how to solve", the content is detailed, the steps are clear, the details are handled properly, I hope this "SpringBoot scan can not Controller how to solve" article can help you solve doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.
SpringBoot rookie created a project and could not scan a series of Controller problems.
1.
two。
3.
4.
5.
6. Another way is to start the introduction to the service class, adding @ ComponentScan (basePackages= {"xxx.xxx.xx", "xxx.xxx.xx"}) to the fully qualified name of the package, which can be used for multiple
SpringBoot Custom controller failed to scan to
The SpringBoot custom controller route could not be found because the startup class and the custom Controller package are not in the same level directory.
Officially recommended location for application.java: the rest of the Bean and application.java are placed in the same package path, but this is not recommended.
The solution:
1. Put the self-built controller class in the same level directory of the startup class (this is not recommended).
2. Change the startup class @ RestController @ EnableAutoConfiguration annotation to @ SpringBootApplication.
3. Start the @ RestController @ EnableAutoConfiguration annotation and add the @ ComponentScan annotation.
There are two ways to configure annotations using springboot scanning:
1. The first kind
@ Controller @ EnableAutoConfiguration @ ComponentScan
2. The second kind
@ SpringBootApplication @ ComponentScan has read this article, "how to solve the problem when SpringBoot cannot be scanned by Controller". If you want to master the knowledge points of this article, you still need to practice and use it. If you want to know more about related articles, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.