mardi 17 mars 2020

How to convert DTO to entity without placing business logic in a converter class?

My entity:

class Voucher {
  Order order;
  Country country;
}

My DTO:

class VoucherDTO {
  Long orderId;
  String countryCode;
}

The problem is that you cannot inject the repository into the converter - this is wrong. Then what to do with this id and code?

The converter class implements the org.springframework.core.convert.converter.Converter<S, T> interface.

Aucun commentaire:

Enregistrer un commentaire