Java 如何使/{repository}/{id}/{property}Spring数据的匹配头保持静止?
我正在使用spring数据rest,并执行类似PUTJava 如何使/{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
/{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请求