No implementation type is registered for return type org.springframework.data.domain.Page.
@Mapper(componentModel = "spring", uses = { OptionalMapper.class, VehicleImageMapper.class, GearShiftMapper.class,
FuelMapper.class, ColorMapper.class, ModelMapper.class, UserMapper.class })
public interface VehicleMapper {
VehicleMapper INSTANCE = Mappers.getMapper(VehicleMapper.class);
VehicleDTO vehicletoVehicleDTO(Vehicle vehicle);
Page<VehicleDTO> vehicletoVehicleDTO(Page<Vehicle> vehicles);
Iterable<VehicleDTO> vehicletoVehicleDTO(Iterable<Vehicle> vehicles);
Vehicle vehicleDTOtoVehicle(VehicleDTO vehicleDTO);
}
My service...
@Override
public Page<VehicleDTO> searchVehiclesByPage(Pageable page) {
Page<VehicleDTO> vehicles = vehicleMapper.vehicletoPageVehicleDTO(vehicleRepository.findAllByEnabled(page));
return vehicles;
}
Can someone help me plz?
This is a known issue in MapStruct. Have a look at mapstruct#607.
There is a workaround for this (I think due to a bug ). The check is only done between the first source parameter and the result type. You will need a wrapper type though, in order to be able to use
@Mapping
and multiple parameters. Which means that the following will work:The check will be done between Integer and Wrapper and it'll be allowed. In order not to expose the dummy you can do something like:
Again this is a workaround to make MapStruct work and it is not a feature. Follow the linked issue in order to know when official support will come.