0

Below is my following Spring Boot Application where I am trying to send the message to Queue but it always throw the NULL on jmsTemplate. Per Spring documentation jmsTemplate should auto configured but it is not happening. is that something I am doing wrong here?

Service class


@Service
@EnableJms
public class CTCall {
       @Autowired
    private JmsTemplate jmsTemplate; //THIS ALWAYS Throw NULL


    public String send() {
        try {
            System.out.println("jmsTemplate:  " + jmsTemplate);
            jmsTemplate.convertAndSend("MYQUEUE", "Hello World!");
            return "OK";
        } catch (Exception ex) {
            ex.printStackTrace();
            return "FAIL";
        }
    }
}

application.properties

ibm.mq.queueManager=MYMGR
ibm.mq.channel=MYQUUE
ibm.mq.connName=MYHOST(1414)
ibm.mq.user=
ibm.mq.password=

POM

  <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ibm.mq</groupId>
            <artifactId>mq-jms-spring-boot-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
user1591156
  • 1,945
  • 4
  • 18
  • 31

1 Answers1

0

You must add @EnableJms to a @SpringBootApplication or @Configuration class

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82