2016-07-03 148 views
1

在我的忍者Web應用程序中,我有一個用於CRUD操作的通用控制器。Ninjaframework MVC控制器繼承和路由

通用接口:

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

摘要控制器:

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

富控制器:

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

當我跑我的忍者的webapp,發生這樣的錯誤:

[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! 

在此先感謝

回答