spring-projects / spring-projects/spring-boot

Review WebServers' auto-start behavior

Open
#44,656 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

status: pending-design-work type: task
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.