NUAAwqy opened a new pull request, #784:
URL: https://github.com/apache/rocketmq-spring/pull/784

   ## What is the purpose of the change
   
   Fix #501.
   
   `@AutoConfigureAfter` / `@AutoConfigureBefore` only take effect between 
auto-configuration classes that are registered in 
`META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports`
 (or, historically, `spring.factories`). In both modules of this project the 
imports file registers exactly one class, `RocketMQAutoConfiguration`; 
`MessageConverterConfiguration`, `RocketMQTransactionConfiguration` and 
`RocketMQListenerConfiguration` are all pulled in through `@Import` on that 
entry class.
   
   The annotations below therefore never influenced any ordering:
   
   - `RocketMQAutoConfiguration`: 
`@AutoConfigureAfter({MessageConverterConfiguration.class})` and 
`@AutoConfigureBefore({RocketMQTransactionConfiguration.class})`
   - `RocketMQListenerConfiguration` (both modules): 
`@AutoConfigureAfter(RocketMQAutoConfiguration.class)`
   
   They mislead readers into copying the pattern (as noted in the issue), so 
this PR removes them. The removal is behavior-preserving: an ordering 
annotation whose target is not a registered auto-configuration has no effect, 
and `@Import` already determines the processing of the imported configurations.
   
   ## Brief changelog
   
   - Remove ineffective `@AutoConfigureAfter` / `@AutoConfigureBefore` 
declarations from the four configuration classes
   - Add `AutoConfigurationOrderingUsageTest` to both modules: asserts that no 
ordering annotation is declared on the imported configurations, and that any 
declared ordering target must be a class registered in 
`AutoConfiguration.imports`
   
   ## Verifying this change
   
   - `mvn -pl rocketmq-spring-boot,rocketmq-v5-client-spring-boot -am test` on 
JDK 17: BUILD SUCCESS
   - rocketmq-spring-boot: 43 tests, 0 failures (including the existing 
`RocketMQAutoConfigurationTest`, confirming bean wiring is unchanged)
   - rocketmq-v5-client-spring-boot: 2 tests, 0 failures
   
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
   - [x] Make sure there is a [Github 
issue](https://github.com/apache/rocketmq-spring/issues) filed for the change 
(usually before you start working on it). Trivial changes like typos do not 
require a Github issue. Your pull request should address just this issue, 
without pulling in other changes - one PR resolves one issue.
   - [x] Format the pull request title following `[ISSUE #xxx] Summary of the 
change`.
   - [x] Write a pull request description that is detailed enough to understand 
what the pull request does, how, and why.
   - [x] Each commit in the pull request should have a meaningful subject line 
and body.
   - [ ] Write necessary unit-test to verify your logic correction, add more 
mock test, necessary javadoc for doc changes.
   - [x] If this contribution is large, please file an [Apache Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.txt).
   


-- 
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