使用Spring Cloud Data Flow Server和shell 1.3.0.M1,Kafka活页夹,以及从Bacon bit-ly URL(1.2.0.RELEASE)加载应用程序。
我在SCDF shell中创建/部署了一个流:
source | httpclient <args> | header-enricher --headers=\"key=payload\" | log
并在标题扩充日志中收到异常:
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\"'
(字符串值),结果相同。
我做错了吗?
答案 0 :(得分:0)
标题扩充程序选项headers
的类型为Properties
,您可以将选项指定为--headers='key=payload'
答案 1 :(得分:0)
我取消注册Bacon.RELEASE(1.2.0)中的header-enricher
应用程序,并使用以下shell命令将其替换为最新快照(1.3.0.BUILD-SNAPSHOT):
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
标头。也许循环引用是一个已经纠正的错误。
----更新----
无论出现什么问题,Celsius.M1里程碑版都会出现纠正。当我使用该版本的应用程序启动器时,不再出现循环引用异常。