Skip to content

@AutoConfigureAfter({MessageConverterConfiguration.class}) and @AutoConfigureBefore({RocketMQTransactionConfiguration.class}) not take effect,They are incorrect usage #501

Open

Description

@Haizi-cp

BUG REPORT

  1. Please describe the issue you observed:
    1668228610407
    @AutoConfigureAfter({MessageConverterConfiguration.class})and@AutoConfigureBefore({RocketMQTransactionConfiguration.class})
    not take effect , They are incorrect usage.
  2. Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc):
    @AutoConfigureAfter and @AutoConfigureBefore, only the autoConfiguration classes under spring.factories will be sorted.
    MessageConverterConfiguration.class and RocketMQTransactionConfiguration.class not under spring.factories , so, They are incorrect usage.
    i want to delete it to fix this problem.
  3. Influence
    now , It will not affect the function as a whole. but when someone read it or learn it and they think it's right.They will also write this in their own projects , this is not a good behavior.

Activity

  1. francisoliverlee commented on Feb 1, 2023

    @francisoliverlee
    Member

    可以提供下复现问题的代码demo嘛 ?

  2. NUAAwqy commented on Nov 11, 2026

    @NUAAwqy

    The ordering annotations are still present on master today and remain ineffective - here is the demonstration that was requested earlier in this issue.

    @AutoConfigureAfter / @AutoConfigureBefore are evaluated by Spring Boot's auto-configuration sorter, which only orders the classes listed in META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports. In both modules that file contains exactly one entry:

    org.apache.rocketmq.spring.autoconfigure.RocketMQAutoConfiguration   # rocketmq-spring-boot
    org.apache.rocketmq.client.autoconfigure.RocketMQAutoConfiguration   # rocketmq-v5-client-spring-boot
    

    MessageConverterConfiguration, RocketMQTransactionConfiguration and RocketMQListenerConfiguration are not registered there - they are all pulled in through @Import on RocketMQAutoConfiguration - so the sorter never sees them and the annotations never take effect:

    • RocketMQAutoConfiguration: @AutoConfigureAfter({MessageConverterConfiguration.class}), @AutoConfigureBefore({RocketMQTransactionConfiguration.class})
    • RocketMQListenerConfiguration (both modules): @AutoConfigureAfter(RocketMQAutoConfiguration.class)

    Verified by removing them: both module test suites pass unchanged on JDK 17 (43 tests in rocketmq-spring-boot, including the existing auto-configuration wiring tests), confirming the annotations were dead code.

    Fix proposed in #784 - it removes the four dead annotations and adds a small regression test per module that fails if an ordering annotation ever references a non-registered auto-configuration again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions