Spring Cloud Stream header enricher 循环引用和 NPE
Spring Cloud Stream header enricher circular reference and NPE
使用 Spring 云数据流服务器和 shell 1.3.0.M1,Kafka 活页夹,并从 Bacon bit-ly URL (1.2.0.RELEASE).
我created/deployed SCDF shell中的一个流shell:
source | httpclient <args> | header-enricher --headers=\"key=payload\" | log
并在 header-enricher 日志中收到异常:
2017-08-29 16:37:16,991 WARN main o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext:550 -
Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'org.springframework.cloud.stream.app.header.enricher.processor.
HeaderEnricherProcessorConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'headerEnricher' defined in org.springframework.cloud.stream.app.header.enricher.processor.HeaderEnricherProcessorConfiguration: Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.integration.transformer.HeaderEnricher]: Circular reference involving
containing bean
'org.springframework.cloud.stream.app.header.enricher.processor.
HeaderEnricherProcessorConfiguration' - consider declaring the factory method as static
for independence from its containing instance. Factory method 'headerEnricher'
threw exception; nested exception is java.lang.NullPointerException
也尝试了 header-enricher --headers=token='\"foo\"'
(字符串值),结果相同。
我是不是做错了什么?
header-enricher 的选项 headers
是 Properties
类型,您可以将选项指定为 --headers='key=payload'
我从 Bacon.RELEASE (1.2.0) 注销了 header-enricher
应用程序,并使用这些 shell 命令:
dataflow:>app unregister --name header-enricher --type processor
dataflow:>app register --name header-enricher --type processor
--uri maven://org.springframework.cloud.stream.app:header-enricher-processor-kafka-10:1.3.0.BUILD-SNAPSHOT
当我使用 --headers='key=payload'
注册我的测试流并像这样部署它时:
dataflow:>stream deploy test --properties "app.header-enricher.spring.cloud.stream.kafka.binder.headers=key"
一切正常。循环引用异常消失了,我在日志接收器收到的消息中看到 key
header。也许循环引用是一个错误,已经得到纠正。
----更新----
无论问题是什么,Celsius.M1 里程碑版本似乎都得到了纠正。当我使用该版本的应用程序启动器时,循环引用异常不再发生。
使用 Spring 云数据流服务器和 shell 1.3.0.M1,Kafka 活页夹,并从 Bacon bit-ly URL (1.2.0.RELEASE).
我created/deployed SCDF shell中的一个流shell:
source | httpclient <args> | header-enricher --headers=\"key=payload\" | log
并在 header-enricher 日志中收到异常:
2017-08-29 16:37:16,991 WARN main o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext:550 -
Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'org.springframework.cloud.stream.app.header.enricher.processor.
HeaderEnricherProcessorConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'headerEnricher' defined in org.springframework.cloud.stream.app.header.enricher.processor.HeaderEnricherProcessorConfiguration: Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.integration.transformer.HeaderEnricher]: Circular reference involving
containing bean
'org.springframework.cloud.stream.app.header.enricher.processor.
HeaderEnricherProcessorConfiguration' - consider declaring the factory method as static
for independence from its containing instance. Factory method 'headerEnricher'
threw exception; nested exception is java.lang.NullPointerException
也尝试了 header-enricher --headers=token='\"foo\"'
(字符串值),结果相同。
我是不是做错了什么?
header-enricher 的选项 headers
是 Properties
类型,您可以将选项指定为 --headers='key=payload'
我从 Bacon.RELEASE (1.2.0) 注销了 header-enricher
应用程序,并使用这些 shell 命令:
dataflow:>app unregister --name header-enricher --type processor
dataflow:>app register --name header-enricher --type processor
--uri maven://org.springframework.cloud.stream.app:header-enricher-processor-kafka-10:1.3.0.BUILD-SNAPSHOT
当我使用 --headers='key=payload'
注册我的测试流并像这样部署它时:
dataflow:>stream deploy test --properties "app.header-enricher.spring.cloud.stream.kafka.binder.headers=key"
一切正常。循环引用异常消失了,我在日志接收器收到的消息中看到 key
header。也许循环引用是一个错误,已经得到纠正。
----更新----
无论问题是什么,Celsius.M1 里程碑版本似乎都得到了纠正。当我使用该版本的应用程序启动器时,循环引用异常不再发生。