I'm trying to send a message with JMS from my application.
I add in my pom
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
The spring getting started say
JmsTemplate and ConnectionFactory are created automatically by Spring Boot. In this case, the ActiveMQ broker runs embedded.
and in my batch writer
@Autowired
JmsTemplate jmsTemplate,
void writer(List<String> items) {
jmsTemplate.convertAndSend(items);
}
But the bean JmsTemplate is not found
No qualifying bean of type 'org.springframework.jms.core.JmsTemplate' available: expected at least 1 bean which qualifies as autowire candidate
I tried to add an message converter in the @configuration
@Bean
public MessageConverter jacksonJmsMessageConverter() {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
return converter;
}
I tried to add the @EnableJMS (even if it's just for listener...)
But it dosen't work...
I don't understand why, on tutorials it looks like easy...
--debug
to see the auto-configuration report. – Gary Russell