1

I have a Spring REST interface and the controller is making the conversion from DTO to Business Entity objects. The Service layer operates on Business Entity objects. However, If my Business Layer wants to call external REST interfaces, where should that Business Entity to DTO conversion happen? At Business Layer? The DAO object using RestTemplate to make the call? Some other layer? The call sequence would current be like this:

business layer -> DAO -> RestTemplate -> RESTful service

Thanks! :)

1 Answer 1

0

Well, normally, in spring framework the conversion of a Model to DTO and backwards, is done by implementing org.springframework.core.convert.converter.Converter interface. Thus, getting a reusable converter which can be used either in Facade or DAO or Controller, depending on your needs. Business Layer should not be concerned about conversion. From my perspective, using converter in DAO is perfectly fine. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.