Skip to main content

juneau-microservice-jetty

Maven
<dependency>
<groupId>org.apache.juneau</groupId>
<artifactId>juneau-microservice-jetty</artifactId>
<version>${juneau.version}</version>
</dependency>
Jarjuneau-microservice-jetty-10.0.0.jar
OSGiorg.apache.juneau.microservice.jetty_10.0.0.jar
LinksMaven 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​

MethodBehavior
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 as Jetty/port in the bundled juneau.cfg.
  • jetty.xml — a minimal Jetty wiring file. A consumer-supplied copy on the working directory or classpath wins via the existing Microservice resolution 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​