Skip to content

@Order annotations not consistently honored within DispatcherServlet and other parts of the framework [SPR-12806] #17403

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

Closed
spring-projects-issues opened this issue Mar 11, 2015 · 1 comment
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 11, 2015

Oliver Drotbohm opened SPR-12806 and commented

DispatcherServlet.initHandlerMappings(…) uses OrderComparator.sort(…) instead of AnnotationAwareOrderComparator.sort(…) which misses out HandlerMappings that use @Order instead of implementing Ordered.

Probably an oversight that stems from the times when @Order didn't even exists. Might be worth grepping the framework sources for other uses of OrderComparator as I think AnnotationAwareOrderComparator should be used everywhere OrderComparator is used nowadays.


Affects: 4.0.9, 4.1.5

Issue Links:

Referenced from: commits 13659d6

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 11, 2015

Juergen Hoeller commented

It's not really an oversight: For traditional Java strategies such as HandlerMapping, we kept using OrderComparator since it fits with the interface model there. Only for annotation-based components, we started delegating to AnnotationAwareOrderComparator.

That said, for 4.2, we are already considering wider use of AnnotationAwareOrderComparator, see e.g. #17018. I suppose we'll cover this for DispatcherServlet's strategies as well then.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants