SPRINGMVC parser cannot map the URL of a controller configuration

Source: Internet
Author: User

When the SPRINGMVC is set up, the configuration file is all right, the project runs successfully, but the HTTP request is not answered, and the log is viewed because there is no controller for the URL, first check that the controller has not been instantiated, and then found that no,  Because there is no related package to introduce Spring-bean, OK careless .... But after the introduction, or the same error, find to find no flaws ah, look for Niang ... Finally found:

<mvc:resourcesMapping= "/images/**" Location= "/web-inf/images/"Cache-period= "31556926"/>      <mvc:resourcesMapping= "/js/**" Location= "/web-inf/js/"Cache-period= "31556926"/>      <mvc:resourcesMapping= "/css/**" Location= "/web-inf/css/"Cache-period= "31556926"/>

Yes, this is the addition of these sentences in the config file, which causes the controller annotations to fail, but why does the controller annotations fail and the controller class can be instantiated by spring?

Finally, the sentence is removed, run, perfect.

But these sentences are used to help static resources escape SPRINGMVC's parser, removing the seemingly not-so-good, workaround:

Add a sentence to these sentences:

</>

I use annotations, spring you need to find annotations .....

In addition to this, there is a workaround, is to declare the path of the static resource in Web. XML to be implemented by the default servlet, is OK, is a bit of trouble

SPRINGMVC parser cannot map the URL of a controller configuration

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.