Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
更换Spring4数据绑定器_Spring_Spring Mvc_Spring Boot - Fatal编程技术网

更换Spring4数据绑定器

更换Spring4数据绑定器,spring,spring-mvc,spring-boot,Spring,Spring Mvc,Spring Boot,我想替换/扩展SpringFramework4DataBinder。我知道还有其他概念,如转换器、属性编辑器和HandlerMethodArgumentResolver 就我的情况而言,我不想使用其中一个。因为Databinder占了我所需函数的95%,我不想再次实现它 事实上,我想将ServletRequestDataBinder子类化并覆盖addBindValues 我不知道如何更换databinder。如果可能的话,我不想替换其他任何东西 有人知道如何在Spring4中使用javaconf

我想替换/扩展SpringFramework4DataBinder。我知道还有其他概念,如转换器、属性编辑器和HandlerMethodArgumentResolver

就我的情况而言,我不想使用其中一个。因为Databinder占了我所需函数的95%,我不想再次实现它

事实上,我想将ServletRequestDataBinder子类化并覆盖addBindValues

我不知道如何更换databinder。如果可能的话,我不想替换其他任何东西


有人知道如何在Spring4中使用javaconfig实现这一点吗?

您应该在大多数情况下使用@InitBinder。这对您不起作用吗?您不能退回新的活页夹。

活页夹未涵盖的5%是多少。虽然可能需要重写一些核心类,并失去自动配置的好处,但我想支持@modeldattributes中的接口。我计划提交一个名为type的字段,它应该指示接口实现。应该首先计算type参数,因为我不想手动绑定其他值或创建具有所有属性的对象。我还没有找到可以访问其他参数的复合属性编辑器。为什么不简单地使用@modeldattribute注释的方法呢?它构造绑定所需的对象。看起来这应该是可行的,而且比重写一些核心spring类要容易得多。不,这就是我问的原因。见对问题的评论。