Spring-json-to-object-transformer 'json' 参数的集成问题必须是以下实例:[class java.lang.String、class
Spring-Integration Issue with json-to-object-transformer 'json' argument must be an instance of: [class java.lang.String, class
我有 spring 集成 5.0.4.RELEASE 相关问题。
我收到如下错误:
java.lang.IllegalArgumentException: 'json' 参数必须是 [class java.lang.String, class [B
的实例
当我尝试执行以下代码时:
<int:header-enricher input-channel="xResponseChannel">
<int:header name="expectedResponseType">
<int-groovy:script>
<![CDATA[
new ParameterizedTypeReference<List<x.y.z.model.Film>>() {}
]]>
</int-groovy:script>
</int:header>
</int:header-enricher>
<int:chain input-channel="xRequestChannel">
<int-http:outbound-gateway url="http://localhost:8084/films"
http-method="GET" expected-response-type-expression="headers[expectedResponseType]" />
<int:json-to-object-transformer
type="x.y.z.model.Film[]" />
<int:service-activator ref="restResponseHandler" />
<int-stream:stdout-channel-adapter
id="consoleOut" append-newline="true" />
</int:chain>
转换器仅支持字符串、字节[]、文件、URL、输入流和Reader。
由于您已经在 HTTP 适配器上设置了预期的响应类型,它已经被转换,所以您不需要转换器。
我有 spring 集成 5.0.4.RELEASE 相关问题。
我收到如下错误: java.lang.IllegalArgumentException: 'json' 参数必须是 [class java.lang.String, class [B
的实例当我尝试执行以下代码时:
<int:header-enricher input-channel="xResponseChannel">
<int:header name="expectedResponseType">
<int-groovy:script>
<![CDATA[
new ParameterizedTypeReference<List<x.y.z.model.Film>>() {}
]]>
</int-groovy:script>
</int:header>
</int:header-enricher>
<int:chain input-channel="xRequestChannel">
<int-http:outbound-gateway url="http://localhost:8084/films"
http-method="GET" expected-response-type-expression="headers[expectedResponseType]" />
<int:json-to-object-transformer
type="x.y.z.model.Film[]" />
<int:service-activator ref="restResponseHandler" />
<int-stream:stdout-channel-adapter
id="consoleOut" append-newline="true" />
</int:chain>
转换器仅支持字符串、字节[]、文件、URL、输入流和Reader。
由于您已经在 HTTP 适配器上设置了预期的响应类型,它已经被转换,所以您不需要转换器。