SPRINGMVC Parent Context-led No mapping found for HTTP request

Source: Internet
Author: User

Build spring MVC today, and the results make a request always no mapping found for HTTP request with URI [******]

So began to troubleshoot a half-day, later on the internet found the concept of parental context,

Just know that every dispatcherservlet of SPRINGMVC will produce a webapplicationcontext ( sub-context ),

It is stored in ServletContext with the Webapplicationcontext ( parent context ) generated by spring initialization

All controller objects must be stored in the SPRINGMVC sub-context , otherwise cannot be found: no mapping found for HTTP request.

    • In the parent context (Applicationcontext.xml), exclude the controller's annotations
<base-package= "com">   <type = "Annotation" expression = "Org.springframework.stereotype.Controller" /> </ Context:component-scan >

Only the controller is scanned in the SPRINGMVC configuration file

<base-package= "Org.apollo.controller"><  type = "Annotation" expression = "Org.springframework.stereotype.Controller" />  </ Context:component-scan >  

and if Parent Context service is configured with a transaction in the the service object cannot be scanned in the child context , otherwise the service transaction is invalidated.

SPRINGMVC Parent Context-led No mapping found for HTTP request

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.