spring - Abstract class and url mapping -
i have abstract class
i try have generic method in class.
i issue mapping.
public abstract class basecontrollernew<t extends baseentity, r extends basedto, s extends basesearch> { ... @getmapping(value = "/{id}") public r getbyid(@pathvariable("id") integer id){ return baseservicenew.getbyid(id); } @getmapping(value = "/") public page<r> get(pageable page){ return baseservicenew.get(page); } .... } @requestmapping(value = "/rest/vehicules") @restcontroller public class vehiculesrestcontroller extends basecontrollernew<vehicules, vehiculesdto, vehiculessearch>{ private vehiculesserviceimpl vehiculesservice; @autowired public vehiculesrestcontroller(final vehiculesserviceimpl vehiculesservice) { super(vehiculesservice); this.vehiculesservice = vehiculesservice; }
i'm able call
/rest/vehicules/1
but 404 for
/rest/vehicules
the problem additional "/", means url "/rest/vehicules/"
you need @getmapping
@getmapping public page<r> get(pageable page){ return baseservicenew.get(page); }
Comments
Post a Comment