I have a mapper be should use of spring component class and normal class for convert fields.
this mapper in following :
@Mapper(componentModel = "spring", uses = { ImagesConverter.class, DateTimeConvertor.class, IntEnumConverter.class,
DownloadModelHelper.class }, nullValueMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT)
public interface PictureMapper {
PictureMapper TRANSLATOR = Mappers.getMapper(PictureMapper.class);
@Mappings({ @Mapping(source = "picture.img", target = "downloadModel"),
@Mapping(source = "picture.id", target = "pictureId"),
@Mapping(source = "galleryPicture.id", target = "galleryPictureID") })
PictureModel entityToModel(Picture entity);
@Mapping(source = "pictureId", target = "picture")
Picture modelToEntity(PictureModel model);
List<PictureModel> entitiesToModels(List<Picture> entityList);
List<Picture> modelsToEntities(List<PictureModel> modelList);
}
ImagesConverter and DateTimeConverter is spring component class be use of @Component.
but IntEnumConverter and DownloadModelHelper is normal class.
when start spring boot get following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pictureMapperImpl': Unsatisfied dependency expressed through field 'downloadModelHelper': No qualifying bean of type [ir.pt.discountnetwork.commons.tools.DownloadModelHelper] found for dependency [ir.pt.discountnetwork.commons.tools.DownloadModelHelper]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations
how to use spring component and normal class with together in mapstruct?