尽管 JBoss (AS 7.1.1.Final) 连接工厂的绑定似乎是成功的:
[org.jboss.as.messaging] (MSC service thread 1-9) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory
查找中的 ConnectionFactory 始终为空。任何人都可以看到问题是什么?
@Configuration
@ComponentScan(basePackages = "reservation")
public class AppConfiguration extends WebMvcConfigurerAdapter {
// ***********************//
// ******** JMS **********//
// ***********************//
@Bean
public ConnectionFactory jmsConnectionFactory() {
JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();
jndiObjectFactoryBean.setJndiName("java:/ConnectionFactory");
return (ConnectionFactory) jndiObjectFactoryBean.getObject();
}
@Bean
public Queue requestsQueue() {
JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();
jndiObjectFactoryBean.setJndiName("java:/queue/test");
return (Queue) jndiObjectFactoryBean.getObject();
}
@Bean
public JmsOperations jmsOperations() {
final JmsTemplate jmsTemplate = new JmsTemplate(jmsConnectionFactory());
jmsTemplate.setDefaultDestination(requestsQueue());
return jmsTemplate;
}
}