Is it bad to create different classes for REST request and response?

前端 未结 3 1629
被撕碎了的回忆
被撕碎了的回忆 2020-12-16 03:10

I\'m working in a Spring Boot project, as my implement at the moment, almost for each API I have request and response classes.

For example:

3条回答
  •  孤街浪徒
    2020-12-16 03:27

    Don't subclass the req/resp objects.

    Use an auto de/serialiser like Jackson in your frame work to convert message payloads into business object.

    However, you will still end up with a large number of business objects.

提交回复
热议问题