Skip to content

Document @Ordered interface use with SpringBootServletInitializer. #2098

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
apogrebnyak opened this issue Dec 9, 2014 · 4 comments
Closed
Labels
type: documentation A documentation update
Milestone

Comments

@apogrebnyak
Copy link

If a legacy web application need to register objects with Servlet framework before SpringBootServletInitializer.onStartup, it can implement it's own WebApplicationInitializer and provide the precedence through the Ordered interface.

SpringServletContainerInitializer sorts all discovered WebApplicationInitializers through AnnotationAwareOrderComparator class. In case if the WebApplicationInitializer does not implement Orderedinterface or is not annotated with @Order annotation, it is assigned LOWEST_PRECEDENCE.

I think it is better to add Ordered implementation to SpringBootServletInitializer and assign default precedence to 0.

This issue came as a work around after regression of #2070 failed

@philwebb
Copy link
Member

philwebb commented Dec 9, 2014

Since SpringBootServletInitializer is abstract and always needs to be subclasses can you not just add @Ordered there?

@apogrebnyak
Copy link
Author

Good point.

Should we add this advice to the class documentation?

BTW. For my original problem I've refactored the legacy initializer and plugged it directly into spring-boot framework.

I will say, that your framework significantly reduced boiler-plate Spring/Servlet components in my system. Thanks for a job well done.

-Alex

@philwebb philwebb changed the title Implement Ordered interface in SpringBootServletInitializer. Document @Ordered interface use with SpringBootServletInitializer. Dec 9, 2014
@philwebb philwebb added this to the 1.2.0 milestone Dec 9, 2014
@philwebb philwebb added the type: documentation A documentation update label Dec 9, 2014
@philwebb
Copy link
Member

philwebb commented Dec 9, 2014

I've added a hint to the Javadoc. Cheers.

@apogrebnyak
Copy link
Author

Thank you,

-Alex

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

No branches or pull requests

2 participants