【发布时间】:2021-03-31 02:29:54
【问题描述】:
我正在使用以下方法来获取 KafkaListener 属性。 但它不解析 containerFactory 值。但它适用于主题和 groupId。
@KafkaListener(topics = "#{__listener.getTopics()}",
groupId = "#{__listener.getGroupId()}",
containerFactory = "#{__listener.getContainerFactory()}")
public void sampleTestTopicListener(@Payload byte[] data,
.....
@Value("sampleTestListenerContainerFactory")
private String containerFactory ;
public String getContainerFactory(){
return containerFactory;
}
....
Spring-kafka-2.2.5.RELEASE
I get the following error :
A component required a bean named '#{__listener.getContainerFactory()}' that could not be found.
Changing the containerFactory value to "sampleTestListenerContainerFactory" instead of spEL, it works fine.
如何使用当前的 beans 属性设置它?
【问题讨论】:
标签: spring-kafka