Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1892] Adjust Upcaster ordering logic in Spring environments #1895

Merged
merged 1 commit into from
Jul 21, 2021

Conversation

smcvb
Copy link
Member

@smcvb smcvb commented Jul 21, 2021

The current solution in the SpringAxonAutoConfigurer will not check whether a bean creation method has the @Order annotation.
It instead only works if the @Order annotation is added to the class of the upcaster itself.

Although this works fine, allowing the @Order annotation to be paired with the @Bean annotation is friendlier.
This pull request adjusts the behavior in the SpringAxonAutoConfigurer such that we look for the @Order annotation through the ListableBeanFactory#findAnnotationOnBean(String beanName, Class<A> annotationClass).
This method takes bean creation methods into account, hence allowing us to check for the order on those.

With these adjustments, issue #1892 is resolved.

The AnnotationAwareOrderComparator does not check for the annotation on
bean creation methods, but only on the classes themselves. We can
instead use the findAnnotationOnBean(beanName, Order.class) method to
get the ordering from any bean creation spot. This allows us to support
the @order annotation on @bean annotated methods or fields too.

#1892
@smcvb smcvb added Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. Type: Enhancement Use to signal an issue enhances an already existing feature of the project. Status: In Progress Use to signal this issue is actively worked on. labels Jul 21, 2021
@smcvb smcvb added this to the Release 4.5.4 milestone Jul 21, 2021
@smcvb smcvb self-assigned this Jul 21, 2021
@sonarcloud
Copy link

sonarcloud bot commented Jul 21, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@lfgcampos lfgcampos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@smcvb smcvb merged commit e9dd6ff into axon-4.5.x Jul 21, 2021
@smcvb smcvb deleted the feature/1892 branch July 21, 2021 12:51
@smcvb smcvb added Status: Resolved Use to signal that work on this issue is done. and removed Status: In Progress Use to signal this issue is actively worked on. labels Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. Status: Resolved Use to signal that work on this issue is done. Type: Enhancement Use to signal an issue enhances an already existing feature of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants