java.util.List.iterator()不是访问器方法

时间:2019-01-09 06:26:12

标签: java spring-boot

当我尝试访问List方法iterator()时,出现以下异常:

java.lang.IllegalArgumentException: Invoked method public abstract java.util.Iterator java.util.List.iterator() is no accessor method!
    at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.3.5.RELEASE.jar:4.3.5.RELEASE]
    at org.springframework.data.projection.MapAccessingMethodInterceptor$Accessor.<init>(MapAccessingMethodInterceptor.java:97) ~[spring-data-commons-1.12.6.RELEASE.jar:na]
    at org.springframework.data.projection.MapAccessingMethodInterceptor.invoke(MapAccessingMethodInterceptor.java:62) ~[spring-data-commons-1.12.6.RELEASE.jar:na]
    at org.springframework.data.projection.ProjectingMethodInterceptor.invoke(ProjectingMethodInterceptor.java:75) ~[spring-data-commons-1.12.6.RELEASE.jar:na]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.5.RELEASE.jar:4.3.5.RELEASE]
    at org.springframework.data.projection.ProxyProjectionFactory$TargetAwareMethodInterceptor.invoke(ProxyProjectionFactory.java:218) ~[spring-data-commons-1.12.6.RELEASE.jar:na]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.5.RELEASE.jar:4.3.5.RELEASE]

下面的代码段:

@RequestMapping (value = "/{field}", method = RequestMethod.PATCH, produces = "application/json")
@ResponseBody
public void applyPatchRequest(@PathVariable String field ,JsonArray operations) {  
    LookupPatchDto lookupPatchDto = new LookupPatchDto();
    lookupPatchDto.setField(field);
    lookupPatchDto.setVals(lookupValsService.getAllByField(field));
    final JsonPatch patch = Json.createPatch(operations);
    final JsonObject result = patch.apply(lookupPatchConverter.toJson(lookupPatchDto));
    lookupPatchDto  = lookupPatchConverter.fromJson(result);
    lookupValsService.save(lookupPatchDto.getVals());
}

在应用套用功能时,我在下面一行出现错误。

final JsonObject result = patch.apply(lookupPatchConverter.toJson(lookupPatchDto));

0 个答案:

没有答案