Search code examples
javamodel-view-controllerninjaframework

Ninjaframework MVC Controller inheritance and routing


In my Ninja Web Application,I've a generic controller for CRUD operation.

Generic Interface:

interface GenericController <T, PK> {
    Result read(PK id);
}

Abstract Controller:

abstract class AbstractController<T, PK extends Serializable> implements GenericController<T, PK>{
    @Override
    public Result read(PK id) {
        return null;
    }
}

Foo Controller:

@Singleton
@Path("/foo")
public class FooController extends AbstractController<FooDto, Long>{
    @Path("/{id}")
    @GET
    @Override
    public Result read(@PathParam("id") Long id) {
    }
}

When I run my ninja webapp, this error occurred:

[NinjaJetty] ERROR ninja.RouteBuilder - Error in route configuration!!!
[NinjaJetty] ERROR ninja.RouteBuilder - Can not find Controller controllers.FooController and method read
[NinjaJetty] ERROR ninja.RouteBuilder - Hint: make sure the controller returns a ninja.Result!
[NinjaJetty] ERROR ninja.RouteBuilder - Hint: Ninja does not allow more than one method with the same name!
[NinjaJetty] ERROR ninja.RouteBuilder - Error in route configuration!!!
[NinjaJetty] ERROR ninja.RouteBuilder - Can not find Controller controllers.FooController and method read
[NinjaJetty] ERROR ninja.RouteBuilder - Hint: make sure the controller returns a ninja.Result!
[NinjaJetty] ERROR ninja.RouteBuilder - Hint: Ninja does not allow more than one method with the same name!
[NinjaJetty] ERROR ninja.RouteBuilder - Can not find Controller controllers.FooController and method read
[NinjaJetty] ERROR ninja.RouteBuilder - Hint: make sure the controller returns a ninja.Result!
[NinjaJetty] ERROR ninja.RouteBuilder - Hint: Ninja does not allow more than one method with the same name!

thanks in advance


Solution

  • It seems to be a java bug. see bug report java 8 and java 6.