Giter Site home page Giter Site logo

Comments (15)

walking98 avatar walking98 commented on September 18, 2024

It should be supported, please modify the version to 1.5.18 and try it. @xiaolongyuan

from rocketmq-spring.

xiaolongyuan avatar xiaolongyuan commented on September 18, 2024

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

from rocketmq-spring.

xiaolongyuan avatar xiaolongyuan commented on September 18, 2024

@walking98

from rocketmq-spring.

xiaolongyuan avatar xiaolongyuan commented on September 18, 2024

image

from rocketmq-spring.

walking98 avatar walking98 commented on September 18, 2024

It can work in my test after change to<spring.boot.version>1.5.18.RELEASE</spring.boot.version> rocketmq-spring-boot-parent/pom.xml

  1. changed the spring.boot.version to 1.5.18.RELEASE
  2. cd rocketmq-spring/
  3. mvn clean install -Dmaven.test.skip
  4. run the samples and verify:
    cd rocketmq-spring-samples
    mvn clean package

@xiaolongyuan

from rocketmq-spring.

xiaolongyuan avatar xiaolongyuan commented on September 18, 2024

image

spring boot 1.5.x依赖为 4.3.x

from rocketmq-spring.

xiaolongyuan avatar xiaolongyuan commented on September 18, 2024

@walking98

from rocketmq-spring.

walking98 avatar walking98 commented on September 18, 2024

The official release version supports Spring boot 2.x + Spring 5.X, the latest spring version.

The issue title should be "support Spring 4.x + Spring 1.X", this is a back-forward compatible issue. we need some investigation and figure out how to support both.

from rocketmq-spring.

walking98 avatar walking98 commented on September 18, 2024

Here is a potential fix: #25

But it might not be checked in due to the official release will support Spring-boot 2.X only.

@xiaolongyuan

from rocketmq-spring.

xiaolongyuan avatar xiaolongyuan commented on September 18, 2024

@walking98 Why support Spring-boot 2.X only ?

from rocketmq-spring.

237chenhao avatar 237chenhao commented on September 18, 2024

@xiaolongyuan
1.
image
2.
image
3.
image

我本地运行demo是OK没有发现明显报错.

from rocketmq-spring.

walkerzhao avatar walkerzhao commented on September 18, 2024

@xiaolongyuan
1.
image
2.
image
3.
image

我本地运行demo是OK没有发现明显报错.

我用你这个改动,mvn clean package 编译就有报错.

我也觉得@walking98 应该支持低版本的spring boot 哇

不然很多使用低版本的springboot的服务,都得为了引入你这个jar包,然后去升级版本,升级版本可能会带来更多不可预料的问题

from rocketmq-spring.

xiaolongyuan avatar xiaolongyuan commented on September 18, 2024

@zhao41654828 我现在用的是 pull里面的那个方案 后面准备全面升级至spring boot 2了

from rocketmq-spring.

walking98 avatar walking98 commented on September 18, 2024

Hope this discussion will help you understand why we no longer support spring boot 1.x
#25

from rocketmq-spring.

walkerzhao avatar walkerzhao commented on September 18, 2024

@zhao41654828 我现在用的是 pull里面的那个方案 后面准备全面升级至spring boot 2了

嗯,我也尝试切spring boot 2 吧

from rocketmq-spring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.