I have a CustomerController and CustomerCardController classes that extend CrudMethods class.
I choose so, because these two controller use the same methods (getFileCustomer() is one of these). And I thought that it had been better use the inheritance to save code's rows.
CustomerController
@Controller
public class CustomerController extends CrudMethods {
...
CustomerCardController
@Controller
public class CustomerCardController extends CrudMethods{
...
CrudMethos
@Controller
public abstract class CrudMethods {
@RequestMapping("getFileCustomer")
@ResponseBody
public String getFileCustomer() {
...
When I run, GlassFish gives me that error:
HTTP Status 500 - Internal Server Error type Exception report
message: Internal Server Error
description: The server encountered an internal error that prevented it from fulfilling this request.
exception:
javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw exception
root cause: Ambiguous mapping found
The problems are @RequestMapping and @ResponseBody annotations.
In fact, if I remove them the application starts.
But I need of these annotation. Because, the @RequestMapping and @ResponseBody are used by Ajax call when the application runs.
And getFileCustomer() is used in both of controllers.
How can solve it?
Thanks