-
Notifications
You must be signed in to change notification settings - Fork 38.1k
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
Sort detected PersistenceExceptionTranslator beans #24644
Sort detected PersistenceExceptionTranslator beans #24644
Conversation
The default |
} | ||
if (comparatorToUse == null) { | ||
comparatorToUse = OrderComparator.INSTANCE; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the above code can be more compact and elegant as
Comparator<Object> comparatorToUse = OrderComparator.INSTANCE;
if (beanFactory instanceof DefaultListableBeanFactory) {
comparatorToUse = ((DefaultListableBeanFactory) beanFactory).getDependencyComparator();
}
or simply
Comparator<Object> comparatorToUse;
if (beanFactory instanceof DefaultListableBeanFactory) {
comparatorToUse = ((DefaultListableBeanFactory) beanFactory).getDependencyComparator();
}
else {
comparatorToUse = OrderComparator.INSTANCE;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefaultListableBeanFactory#getDependencyComparator()
is @Nullable
, so it might return null
.
Apply sorting on detected PersistenceExceptionTranslators. Relates to spring-projects#24634
2bf1975
to
4b09631
Compare
As indicated on #25559, I've resolved this in a different way, calling Thanks for the pull request, in any case! |
Apply sorting on detected
PersistenceExceptionTranslators
.Relates to #24634