In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge points about how to solve the problem when springMVC does not scan controller. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
SpringMVC does not scan controller
Recently, I imported a previous Maven project into Eclipse in a new computer environment, but found a way not to scan controller when I started it.
Here is the correct spring-mvc.xml file text/html Charset=UTF-8 So what is the reason why I have this problem?
Because of the newly configured environment and the lack of many jar packages, after the project was imported into Eclipse, the file reported that there was an error in this sentence.
If there was a mistake, I deleted it without thinking about it.
Well, that's how the problem arises.
Summary: after importing a project, there may be a lot of errors, but for some configuration files, the solution should not be to delete or modify the contents of the file
Instead, we should first solve problems such as dependence, otherwise projects like me that have no problems before will have strange problems just because of the change of environment.
SpringMVC package scanning problem Why does @ COntroller put it in springMVC?
The bean of @ Controller annotation must be managed by the children webApplicationContext initialized by DispatcherServlet. In the context initialized by DispatcherServlet, all bean instances of the current container are scanned, and the corresponding HandleMappering information is annotated and assembled according to the mapping information at the class level and method level. However, ContextLoaderListener does not have this feature.
In a word, there is no way to scan the bean of controller in spring, so you can scan all of them in spring, but it doesn't work for @ controller, so you have to add another scan to controller in springMVC.
PS: when you encounter a thing before, it doesn't work to put @ Transactional in COntroller at first, because it is only configured in spring.
The Controller does not match, because it will only look for the @ Transactional annotation on the bean defined in the same application file. If you put it in the Dispatcher application context, it will only check the @ Transactional annotation on the controller (Controller), not the @ Transactional annotation on your services.
These are all the contents of this article entitled "how to solve the problem in springMVC without scanning controller". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.