I have an abstract class
I try to have all generic method in this class.
I get issue about 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 to call
/rest/vehicules/1
but i get 404 for
/rest/vehicules
The problem is with your additional "/", this means your URL will be "/rest/vehicules/"
You only need @GetMapping
@GetMapping
public Page<R> get(Pageable page){
return baseServiceNew.get(page);
}