You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2018/12/24 05:17:33 UTC

[GitHub] xiaolongyuan edited a comment on issue #21: Support Spring boot 1.5.18 ?

xiaolongyuan edited a comment on issue #21: Support Spring boot 1.5.18 ?
URL: https://github.com/apache/rocketmq-spring/issues/21#issuecomment-449687291
 
 
   Not supported.
   
   ListenerContainerConfiguration.java
   
   ```
   private void registerContainer(String beanName, Object bean) {
           Class<?> clazz = AopUtils.getTargetClass(bean);
           if (!RocketMQListener.class.isAssignableFrom(bean.getClass())) {
               throw new IllegalStateException(clazz + " is not instance of " + RocketMQListener.class.getName());
           } else {
               RocketMQMessageListener annotation = (RocketMQMessageListener)clazz.getAnnotation(RocketMQMessageListener.class);
               this.validate(annotation);
               String containerBeanName = String.format("%s_%s", DefaultRocketMQListenerContainer.class.getName(), this.counter.incrementAndGet());
               GenericApplicationContext genericApplicationContext = (GenericApplicationContext)this.applicationContext;
               genericApplicationContext.registerBean(containerBeanName, DefaultRocketMQListenerContainer.class, () -> {
                   return this.createRocketMQListenerContainer(bean, annotation);
               }, new BeanDefinitionCustomizer[0]);
               DefaultRocketMQListenerContainer container = (DefaultRocketMQListenerContainer)genericApplicationContext.getBean(containerBeanName, DefaultRocketMQListenerContainer.class);
               if (!container.isRunning()) {
                   try {
                       container.start();
                   } catch (Exception var9) {
                       log.error("Started container failed. {}", container, var9);
                       throw new RuntimeException(var9);
                   }
               }
   
               log.info("Register the listener to container, listenerBeanName:{}, containerBeanName:{}", beanName, containerBeanName);
           }
       }
   ```
   
   genericApplicationContext.registerBean is Spring 5.x 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services