What is a Command Object in Spring?

What is a command object in Spring framework? What is a data transfer object (DTO)?

As we known, a data transfer object (DTO) is a simple java bean that carries data between any two layers or processes. We can generally use DTO layer & populate the DTO object with the data received from the external web service or external system. 

What is a Command Object in Spring?

Just like data transfer object (DTO), Command Object also is data carriers from one layer to the other.

The concept from Spring Documentation:

Command object is just a spring (mvc) terminology which maps the html form data to a java bean (form bean). 

Command Object – a JavaBean which will be populated with the data from your forms.

So, we can consider the Command Object as a POJO/JavaBean/etc.. that backs the form in the presentation layer.

You can learn about an example of Command Objects in Spring  here.