Edit: please read the question curefully, I don't need answers that repeat what I wrote.
Looking aroung the web I found quite a confusion about this subject.
What I'm looking for is a nice way to extend the value of a Controller
's RequestMapping
annotation.
Such as:
@Controller
@RequestMapping("/api")
public class ApiController {}
@Controller
@RequestMapping("/dashboard")
public class DashboardApiController extends ApiController {}
The result should be ("/api/dashboard")
.
This approach apparently simply override the RequestMapping
value.
A working approach may be to not put a RequestMapping annotation on the derived class.
@Controller
public class DashboardApiController extends ApiController
{
@GetMapping("/dashboard")
public String dashboardHome() {
return "dashboard";
}
... other methods prefixed with "/dashboard"
}
Is this the only feasible approach? I don't really like it.