0
我试过这个解决办法,但我的实现似乎并不工作:How to access Default Idempotent Repository map from java dsl?为什么在构建端点时,java bean不会转换为camel IdempotentRepository?
@Bean
@Scope("prototype")
public static IdempotentRepository<String> getMemoryCache() {
return new MemoryIdempotentRepository();
}
,然后我尝试做一个参考,以它在我的URI,它抛出一个异常,这样说:
java.lang.IllegalArgumentException: Could not find a suitable setter for property: idempotentRepository as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: org.apache.camel.spi.IdempotentRepository with value #getMemoryCache()
..我做了什么来构建URI:
URIBuilder builder = _INSTANCE.getSourceFolderEndpointUriBuilder(exchange);
builder.setScheme("file");
builder.addParameter("recursive", "true");
builder.addParameter("readLock", "none");
builder.addParameter("idempotentRepository", "#getMemoryCache()");
是它只是bean的名称,默认情况下它使用方法的名称。但是你也可以在这些'@ Bean'注释中声明这个名字 –