如何在运行时创建多个DefaultMessageListenerContainer实例?
现在我有2个豆子:
@Bean
public DefaultMessageListenerContainer defaultMessageListenerContainer(CachingConnectionFactory cachingConnectionFactory, MQQueue mqQueue,
MessageListenerAdapter messageListenerAdapter) {
DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
//read some properties and set to dmlc
return defaultMessageListenerContainer;
}
@Bean
public DefaultMessageListenerContainer defaultMessageListenerContainer2(CachingConnectionFactory cachingConnectionFactory, MQQueue mqQueue,
MessageListenerAdapter messageListenerAdapter) {
DefaultMessageListenerContainer dmlc = new DefaultMessageListenerContainer();
//read some properties and set to dmlc
return defaultMessageListenerContainer;
}
它工作正常。但我希望DefaultMessageListenerContainer
的n个实例取决于我的属性文件。
我怎样才能实现它?