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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -