I have the following routes mapped via @RequestMapping (GET) in a Spring Boot Rest Controller
/base/{baseName}
/base/{baseName}/next/{nextName}
I also have the following wildcard routes
1. /base/{baseName}/**
2. /base/{baseName}/next/{nextName}/*
Which work for the following cases
GET /base/baseName
GET /base/baseName/foo # Hits 1
GET /base/baseName/foo/bar/etc # Hits 1
GET /base/baseName/next/nextName
GET /base/baseName/next/nextName/foo # Hits 2
The only situation that doesn't work is
GET /base/baseName/next/nextName/foo/bar... # Hits 1
as I want it to hit route 2 instead.
It doesn't work because the matching precedence in Spring Boot dictates that wildcard routes 1 and 2 have the same values (1 point for every wildcard, 1 point for every template).
Since route 2 can't match unlimited directories, it doesn't work. If I were to add an additional wildcard, route 1 would always take precedence.
Is there any way to change the precedence rules, or restructure my mappings?