我正在开发基于 JMS 的模块,它使用来自 IBM MQ 的消息并保存数据。我的应用程序在 TomEE 8.0.0-M2 中运行。在启动我的应用程序时,我注意到Auto-linking resource-ref 'openejb/Resource正在针对我的所有 EJB bean 发生。我已经在 resources.xml 中配置了我的 IBM MQ 相关工厂和队列以及主题。所有 IBM MQ 相关资源都在尝试与我的所有 EJB bean 自动链接,这会消耗更多的启动时间。
我的所有 EJB 都没有 @Resource 配置。我有带有@MessageDriven注释的 MDB bean。
为什么 TomEE 试图自动链接到所有 EJB bean?
如何解决这种自动喜欢?
我准备在 web.xml 或 resources.xml 中进行任何一次配置
针对一个 EJB Bean ( SimpleService ) 的示例日志
08-Mar-2019 13:33:07.558 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/ROOT/imq_ra' in bean SimpleService to Resource(id=imq_ra)
08-Mar-2019 13:33:07.559 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/imq_ra' in bean SimpleService to Resource(id=imq_ra)
08-Mar-2019 13:33:07.559 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/ROOT/ibm.mq.connfactory' in bean SimpleService to Resource(id=ibm.mq.connfactory)
08-Mar-2019 13:33:07.559 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/ibm.mq.connfactory' in bean SimpleService to Resource(id=ibm.mq.connfactory)
08-Mar-2019 13:33:07.561 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/ROOT/imq_container-javax.jms.QueueConnectionFactory' in bean SimpleService to Resource(id=imq_container-javax.jms.QueueConnectionFactory)
08-Mar-2019 13:33:07.562 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/imq_container-javax.jms.QueueConnectionFactory' in bean SimpleService to Resource(id=imq_container-javax.jms.QueueConnectionFactory)
08-Mar-2019 13:33:07.562 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/ROOT/imq_container-javax.jms.TopicConnectionFactory' in bean SimpleService to Resource(id=imq_container-javax.jms.TopicConnectionFactory)
08-Mar-2019 13:33:07.563 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/imq_container-javax.jms.TopicConnectionFactory' in bean SimpleService to Resource(id=imq_container-javax.jms.TopicConnectionFactory)
08-Mar-2019 13:33:07.566 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/ROOT/download.topic' in bean SimpleService to Resource(id=download.topic)
08-Mar-2019 13:33:07.571 INFO [localhost-startStop-1] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/download.topic' in bean SimpleService to Resource(id=download.topic)