Class EphemeralJettyServerConfig
@Configuration that supplies a Jetty Server bound to an OS-assigned ephemeral port
(port 0) for use by @MicroserviceTest-driven integration tests.
The server has a single ServerConnector on port 0 and a single root ServletContextHandler
at context path "/". JettyServerComponent discovers the handler via the
"ServletContextHandler" server attribute (the same convention used by jetty.xml).
The extension installs this @Configuration automatically after the user-supplied configurations, so
a user-supplied @Bean Server (if any) still wins (the bean store returns the first registered match).
Tests supply their @Bean Servlet definitions, which JettyServerComponent auto-mounts at the
resource's @Rest(path=...).
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.jetty.server.ServerProvides the bean-supplied JettyServerthatJettyServerComponentconsumes duringonStart().Disables the 30s graceful-shutdown drain wait for integration tests.
-
Constructor Details
-
EphemeralJettyServerConfig
public EphemeralJettyServerConfig()
-
-
Method Details
-
jettyServer
Provides the bean-supplied JettyServerthatJettyServerComponentconsumes duringonStart().- Returns:
- A configured
Serverbound to port 0 (OS-assigned ephemeral port).
-
jettySettings
Disables the 30s graceful-shutdown drain wait for integration tests.JettyServerComponentapplies a 30sstopTimeoutdefault to support zero-downtime k8s rollouts. In ephemeral test servers there are no load balancers or in-flight production traffic, so the drain wait only adds ~1s per test class to the suite runtime. Setting it to zero restores fast shutdown.- Returns:
JettySettingswithstopTimeoutset to zero.
-