0

I have following two mapping in Spring Controller

1. @RequestMapping(value = {"/projects/{title}_{id}/home"})

and

2. @RequestMapping(value = {"/projects/{title}/home"})

My requirement is to give priority to first mapping but Spring is matching the second for the URL "/project/xyz-abc_20/home"

How can I solve this?

Spring version - 4.3.7.RELEASE

pankaj
  • 1,643
  • 4
  • 22
  • 35

1 Answers1

1

If you make the second mapping less specific, like that :

@RequestMapping(value = {"/projects/{title}**/home"})

the first one will have priority. I tested it and it worked.

More explanations here : https://stackoverflow.com/a/27885037/2110284

Romain Warnan
  • 1,022
  • 1
  • 7
  • 13