Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如果您使用的是@EnableWebMvc注释,为什么@RequestBody调用的Dto必须用@NoArgsConstructor注释?_Java_Spring_Rest_Annotations - Fatal编程技术网

Java 如果您使用的是@EnableWebMvc注释,为什么@RequestBody调用的Dto必须用@NoArgsConstructor注释?

Java 如果您使用的是@EnableWebMvc注释,为什么@RequestBody调用的Dto必须用@NoArgsConstructor注释?,java,spring,rest,annotations,Java,Spring,Rest,Annotations,当在项目中使用@EnableWebMvc时,@RequestBody注释在RestController中使用的Dto的原因是什么 如果project没有@EnableWebMvc,则可以轻松地使用@Getter注释自动映射,而无需@noargsconstuctor如果您使用@EnableWebMvc,这意味着您将赋予Spring执行必要操作的责任@EnableWebMvc确保Spring使用预定义的注释@noargsconstuctor从用户手中控制必要的无参数构造函数 它还避免了开发人员必须编

当在项目中使用
@EnableWebMvc
时,
@RequestBody
注释在
RestController
中使用的
Dto
的原因是什么


如果project没有
@EnableWebMvc
,则可以轻松地使用
@Getter
注释自动映射,而无需
@noargsconstuctor

如果您使用@EnableWebMvc,这意味着您将赋予Spring执行必要操作的责任@EnableWebMvc确保Spring使用预定义的注释@noargsconstuctor从用户手中控制必要的无参数构造函数


它还避免了开发人员必须编写的不必要的锅炉板代码。

如果您使用@EnableWebMvc,这意味着您将赋予Spring完成必要工作的责任@EnableWebMvc确保Spring使用预定义的注释@noargsconstuctor从用户手中控制必要的无参数构造函数

它还避免了开发人员必须编写的不必要的锅炉板代码