Using the setAllowedFields() method in Spring

后端 未结 4 744
后悔当初
后悔当初 2021-01-15 05:56

I\'m using Spring 3.2.0. I have registered a few custom property editors for some basic needs as follows.

import editors.DateTimeEditor;
import edito         


        
4条回答
  •  暖寄归人
    2021-01-15 06:29

    setAllowedFields() is very handy when using entity objects directly in web layer. Alternatively, one could use dedicated data transfer objects (DTO), from which entity objects are constructed in the service layer. Not only can the factories be re-used, but also used outside the web context, e.g. for asynchronous messages. Besides, DTO inheritance doesn't have to follow entity inheritance, so you are free to design the DTO hierarchy according to the needs of the use-cases.

提交回复
热议问题