NUAAwqy commented on issue #501:
URL: 
https://github.com/apache/rocketmq-spring/issues/501#issuecomment-6802050557

   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to