Я работаю с пружинной загрузкой и пытаюсь сопоставить сущность и dto. Вот мой картограф
@Mapper(componentModel = "spring", uses = {})
public interface SourceTargetMapper {
UtilisateurDto UtilisateurToUtilisateurDto(Utilisateur entity);
Utilisateur UtilisateurDtoToUtilisateur(UtilisateurDto dto);
}
Я пытался использовать отображение в serviceImplementation так:
@Service
public class UserServiceImpl implements UserService{
@Autowired
UserRepository userRepository;
@Autowired
SourceTargetMapper sourceTargetMapper;
...
public UtilisateurDto findOne(Long id) {
Utilisateur utilisateur = userRepository.findOne(id);
UtilisateurDto utilisateurDto = sourceTargetMapper.UtilisateurToUtilisateurDto(utilisateur);
return utilisateurDto;
}
но когда я выполняю компилятор и возвращает это сообщение:
Описание:
Поле sourceTargetMapper в com.ezedin.app.services.servicesImpl.UserServiceImpl требуется компонент типа 'com. ezedin.app.mapper.SourceTargetMapper ', который не может быть найден.
Действие:
Рассмотрим определение компонента типа' com.ezedin .app.mapper.SourceTargetMapper 'в вашей конфигурации.