Ambiguous handler methods mapped for HTTP path

Source: Internet
Author: User

Problem: errors caused by mapping duplication

The Java code is as follows:

  @RequestMapping (value = "/info/{remove}/{id}", method = requestmethod.get) public    String Removenewsbyid (@ Pathvariable ("id") long ID) {
@RequestMapping (value = "/info/{fav}/{id}", method = requestmethod.get) public    String Increasefavoritebyid (@ Pathvariable ("id") long ID) {

Report the following error:

Message Request processing failed; Nested exception is java.lang.IllegalStateException:Ambiguous handler methods mapped for HTTP path ' http://localhost:808 0/ZC-BEAUTY2/NEWS/INFO/FAV/6 ': {public java.lang.String com.zc.beauty.controller.NewsController.removeNewsById ( Long), public java.lang.String com.zc.beauty.controller.NewsController.increaseFavoriteById (Long)}


My intention was to visit/info/remove/id and/info/fav/id respectively.

There is a problem with the notation: variables wrapped with {} appear to be blurred:

/info/{remove}/{id} and

/info/{fav}/{id}

The mappings are duplicates.

Second, the solution:

Written in the following format:

/info/remove/{id}

Do not add {} for the determined path parameter

Problem solving.

The above describes the ambiguous handler methods mapped for HTTP path, including aspects of the content, I hope to be interested in the JSP tutorial friends helpful.

Transfer from http://www.codes51.com/article/detail_161369.html

Ambiguous handler methods mapped for HTTP path

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.