juneau-microservice-jetty
| Maven | |
|---|---|
| Jar | juneau-microservice-jetty-10.0.0.jar |
| OSGi | org.apache.juneau.microservice.jetty_10.0.0.jar |
| Links | Maven Central · Javadocs · Source |
Contents/Features
Juneau Microservice Jetty is an API for creating stand-alone executable jars that can be used to start lightweight configurable REST interfaces with all the power of the Juneau REST server and client APIs.
Zero-config facade
JettyMicroservice is a thin static-call facade that collapses the standard Microservice +
JettyConfiguration bootstrap into a single line. For what changed from earlier releases, see the
v10.0 Migration Guide.
Canonical entry point
public static void main(String[] args) throws Exception {
JettyMicroservice.run(args, new RootResources()).join();
}
That one call boots Jetty on port 10000 (the bundled default), registers your root servlet, starts the interactive
console, and blocks until the process is stopped.
Three overloads
| Method | Behavior |
|---|---|
JettyMicroservice.run(args, rootServlet) | Starts with the interactive console enabled (equivalent to startConsole=true). |
JettyMicroservice.run(args, rootServlet, startConsole) | Explicit console opt-in/opt-out. Pass false to suppress the interactive prompt. |
JettyMicroservice.run(args, beanStore, startConsole, configurations...) | Power-user form: supply your own WritableBeanStore and configuration class list. Use when you need multiple @Bean Servlet contributions, custom MicroserviceListeners, or a parent bean store. |
All three return the started Microservice instance; callers wanting "start and block forever" should chain
.join() on the result.
Bundled classpath defaults
The facade's two-argument form pre-wires JettyConfiguration, which provides:
- Port
10000— surfaced asJetty/portin the bundledjuneau.cfg. jetty.xml— a minimal Jetty wiring file. A consumer-supplied copy on the working directory or classpath wins via the existingMicroserviceresolution chain.juneau.cfg— the runtime configuration file; same override semantics.
To override any of these defaults without replacing the whole configuration, supply a file by the same name earlier on the classpath or in the working directory.
In This Section
📄️ 4.2.1. Microservice Jetty Overview
The Jetty Microservice API consists of a combination of the Juneau Core, Server, and Client APIs and an embedded Eclipse
📄️ 4.2.2. Lifecycle Methods
The lifecycle methods of the Microservice class
📄️ 4.2.3. Resource Classes
This section describes how to define a top-level REST resource page and deploy it in our microservice.
📄️ 4.2.4. Predefined Resource Classes
The following classes are reference/demo resources that illustrate common microservice admin patterns. They live in the
📄️ 4.2.5. Jetty.xml file
The Jetty microservice comes with a bare-bones jetty.xml file which can be modified to suite any needs.
📄️ 4.2.6. UI Customization
The Microservice project contains a files/htdocs folder with predefined stylesheets and images.
📄️ 4.2.7. Customizing via @Bean
As of 10.0, JettyMicroservice was reshaped — the legacy subclass form was retired, and a thin static-call facade
📄️ 4.2.8. Health / Readiness / Liveness Probes
See also: REST Server — Mixins and Multi-Mount Paths — the underlying @Rest(mixins=...) and @Rest(paths=...) composition primitives this page is built on.
📄️ 4.2.9. Graceful Shutdown & Readiness Gating
See also: Health / Readiness / Liveness Probes — the probe surface (/healthz, /readyz, /livez) this page gates during shutdown.
📄️ 4.2.10. Management Surface (Actuator-style endpoints)
See also: Health / Readiness / Liveness Probes — the health half of the management surface, and REST Server — Mixins and Multi-Mount Paths — the @Rest(mixins=...) composition primitives this page builds on.