Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/310.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 如何使/{repository}/{id}/{property}Spring数据的匹配头保持静止?_Java_Spring Data_Spring Data Rest - Fatal编程技术网

Java 如何使/{repository}/{id}/{property}Spring数据的匹配头保持静止?

Java 如何使/{repository}/{id}/{property}Spring数据的匹配头保持静止?,java,spring-data,spring-data-rest,Java,Spring Data,Spring Data Rest,我正在使用spring数据rest,并执行类似PUT/{repository}/{id}/{property} Body: /12 Accept: application/json Content-Type: text/uri-list If-Match: 42 (incorrect value) 我希望得到412错误,但返回204 当我调试时,我发现DispatcherServlet使用带有[org.springframework.data.rest.webmvc.RepositoryPro

我正在使用spring数据rest,并执行类似PUT
/{repository}/{id}/{property}

Body:
/12
Accept: application/json
Content-Type: text/uri-list
If-Match: 42 (incorrect value)
我希望得到412错误,但返回204

当我调试时,我发现DispatcherServlet使用带有[org.springframework.data.rest.webmvc.RepositoryPropertyReferenceController#createPropertyReference(RootResourceInformation,HttpMethod,CollectionModel,Serializable,String)]和3个拦截器的
HandlerExecutionChain,并且该方法不检查值是否匹配

并且只有像这样的请求:PUT、PATCH、DELETE
/{repository}/{id}
使用
HandlerExecutionChain和[org.springframework.data.rest.webmvc.RepositoryEntityController#patchItemResource(RootResourceInformation,PersistentEntityResource,Serializable,PersistentEntityResourcesAssembler,ETag,String)]和3个拦截器
,用于检查值是否匹配


可以让spring数据rest验证PUT、DELETE、PATCH
/{repository}/{id}/{property}
的值是否匹配吗?

根据

如果要对嵌入属性(字段)进行版本设置,如何分别对单个嵌入属性进行版本设置?答案是不可能的

如果要对引用的属性(JPA join)进行版本设置,则应向/{that property repository}/{id}而不是/{repository}/{id}/{property}发出PUT/PATCH/DELETE请求