问题描述
我正在尝试为 WildFly 11 Spring 应用程序实现 JMS,但我似乎遗漏了一些东西。
我一直在遵循这两个指南:
- https://docs.moogsoft.com/AIOps.7.3.0/configure-jboss--wildfly-.html
- https://fabianogoes.gitbooks.io/jms/content/jms-spring-boot-wildfly.html
一切都很好,直到我实现 MessageProducerConfiguration。
@Component
public class MessageProducerConfiguration {
private final JmsTemplate jmsTemplate;
@Autowired
public MessageProducerConfiguration(JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate;
}
public void send(String message) {
jmsTemplate.convertAndSend("test_queue",message);
}
}
当我启动 WildFly 服务器时,出现以下错误
12:12:56,800 ERROR [org.springframework.web.servlet.DispatcherServlet] (ServerService Thread Pool -- 84) Context initialization failed: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'testQueueMessageProducerConfiguration' defined in VFS resource ["/C:/Users/meloni.marco/wildfly-11.0.0.Final/standalone/deployments/concorsi.ear/concorsi.war/WEB-INF/classes/com/mef/sp/config/jms/TestQueueMessageProducerConfiguration.class"]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.jms.core.JmsTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
我认为是 JmsTemplate 需要一个显式的 Bean。由于指南没有提到它,我想我遗漏了一些简单的东西,而且我不想为此添加旧的 bean 定义。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)