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
Embedded Tomcat does not honor ServletContainerInitializers #321
Comments
This was actually an intentional design decision. The search algorithm used by the containers was problematic. It also causes problems when you want to develop an executable WAR as you often want a See the Do you have a specific case where this is causing problems or was it more of an observation? |
The Cloud Foundry Java Buildpack contributes a JAR to do auto-reconfiguration (re-writing bean definitions, setting profiles, etc.). To get the auto-reconfiguration started we use a I'm a little fuzzy on exactly how the |
The |
I had a crack at the |
Not sure I follow. Are you saying that |
That's my initial indication. I've put in on the back burner for a moment while I clear out some other stuff in our backlog. Leave this issue with me for a couple of days and I'll get back to you with a definitive answer. |
@philwebb I've finally gotten back to this particular issue and yes, I believe that |
Unless @dsyer has time to look at this we might need to leave it as a known issue for 1.0.0. I need to focus the next few weeks on documentation and critical bugs. Can we pick it up again when the pressure is off? |
I don't think we'll ever be able to magically execute all SCIs. That's why I left it as "discussion". And there's definitely nothing happening to that in 1.0. We can take the |
Yeah, no worries. I left it until much too late for you guys, and am happy to let it go. I'll open another issue with the |
@philwebb could you be a bit more explicit what lead you to this design decision? What's problematic about the search algorithm? Where in the boot source code do you disable that feature? Why wouldn't you want the Also it's not magical to execute all Servlet 3.0 made a really good job at defining this interface and the The goal of these servlet 3.0 mechanisms is to enable integration of standardized components without the user having to explicitly configure something. It's sad that boot makes that impossible :( |
friendly ping 😉 |
Equally friendly reminder that nothing has changed :-). And that you are commenting on a closed issue. |
I just want to know more about the reasons about this decision and wether you might overthink it. Did you read my comment from 8 days ago? It would be great if you could answer my questions. |
There are lifecycle issues. The servlet context is not available when it is needed from what I remember. I'd be happy to be proved wrong, so please feel free to try it and report back. |
Have you considered using This is my quick and dirty try:
Is that a route you are willing to go? Would you consider using ContextConfig as a default |
What does it have to do with web sockets (other than the fact that Tomcat packages its ws support as an SCI)? Isn't that the wrong place to put a customizer? Anyway, I wouldn't rule anything out, but I suspect you will have issues with some SCIs (in particular the one in Spring). Did you try it? |
I'm sorry, I meant |
Try all the samples, and also try deploying a war file to an existing container. That should shake anything loose that we missed so far. Of course this is only the Tomcat support and we'd probably have to find a way to do the same with the other platforms, but it's a start if it works. |
Is a way to do a automated integration test for the samples? |
Not with a war deployment (as far as I know). But "mvn test" is a good start. |
The spring-boot-samples tests are passing. Deploying the spring-boot-sample-web-jsp war to tomcat did also work. But the tests in
The Javadoc of
So we probably have to find a way how to not invoke |
Currently, the embedded Tomcat container does not detect and execute
ServletContainerInitializers
. This means that dependencies that use them are never called and therefore are unable to contribute to the running application.The embedded Tomcat container should be enhanced such that it properly notices the
ServletContainerInitializers
on the Application's classpath and executes them.The text was updated successfully, but these errors were encountered: