spring-projects / spring-projects/spring-boot
Review WebServers' auto-start behavior
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
Auto-start was introduced before 1.0. The intent appears to have been to prevent the server from starting. At the time it was when the port was set to 0. It's now when the port is set to a negative value. ServletContextAware is also mentioned which suggests that such components should still be called with the current ServletContext.
I think the name autoStart is misleading. It doesn't control whether the web server will be started automatically, but what start will do. Put another way, calling start() on a web server with auto-start disabled does not put it in the same state as one that was created with auto-start enabled.
We have four web servers now, and various behaviors when auto-start is disabled:
| WebServer | Auto-start disabled behavior |
|---|---|
NettyWebServer |
No auto-start support |
JettyWebServer |
Server isn't started at all |
TomcatWebServer |
Tomcat is started but the connector's protocol handler is stopped |
UndertowWebServer |
Undertow instance isn't even created |
With the opportunity that 4.0 provides for breaking changes, we should review the auto-start behavior. Given the inconsistency of the current implementations we should consider if the feature's needed at all. It also doesn't appear to be documented so it perhaps isn't widely used. If we want to keep it, we should, if possible, offer consistent behavior across all web servers. We should also consider renaming it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the auto-start handling in NettyWebServer, JettyWebServer, TomcatWebServer, and UndertowWebServer. Review the linked introduction commit and current behavior for disabled auto-start, then determine whether the feature should remain and what consistent behavior or renaming is required. Done means the project has a decided, consistent approach across the web servers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100