Class JettyMicroservice
Wraps the Microservice + JettyConfiguration bootstrap in a single static call so
a consumer can stand up a Jetty microservice with one Maven dependency and one line of code:
Bundled defaults (all overridable):
- Port
10000 (surfaced asJetty/port in the bundledjuneau.cfg ). - Interactive console enabled (use
run(String[], Servlet, boolean)withstartConsole=falseto suppress). - Classpath defaults for
jetty.xml andjuneau.cfg — a consumer-supplied copy on the working-directory or classpath wins via the existingMicroserviceresolution chain.
The supplied root servlet is registered as a @Bean Servlet in an external bean store and
auto-mounted by JettyServerComponent
at the path declared by its @Rest annotation. Consumers
who want full control over the bean store / configuration classes / listener wiring should call
Microservice.create() directly — this facade is a thin convenience over that builder.
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic MicroserviceBoots a Jetty microservice with the supplied root servlet and the bundled defaults, with the interactive console enabled.static MicroserviceBoots a Jetty microservice with the supplied root servlet and the bundled defaults.static Microservicerun(String[] args, WritableBeanStore beanStore, boolean startConsole, Class<?>... configurations) Power-user form: boots a Jetty microservice with a caller-supplied bean store and configuration class list.
-
Method Details
-
run
Boots a Jetty microservice with the supplied root servlet and the bundled defaults, with the interactive console enabled.Equivalent to calling
run(args, rootServlet, true).- Parameters:
args- Themain(String[])arguments. Forwarded toMicroservice.Builder#args(String...).rootServlet- The root REST servlet (typically annotated with@Rest).- Returns:
- The started
Microserviceinstance. Callers typically chainMicroservice.join(). - Throws:
Exception- Error occurred during bootstrap.
-
run
public static Microservice run(String[] args, jakarta.servlet.Servlet rootServlet, boolean startConsole) throws Exception Boots a Jetty microservice with the supplied root servlet and the bundled defaults.Constructs the
Microservice, registers the supplied servlet as a@Bean ServletsoJettyServerComponentauto-mounts it, appliesJettyConfigurationso Jetty itself is wired, and starts the lifecycle. The returned microservice has not yet beenjoined; callers wanting the standard "start and block forever" loop should chain.join().- Parameters:
args- Themain(String[])arguments. Forwarded toMicroservice.Builder#args(String...).rootServlet- The root REST servlet (typically annotated with@Rest).startConsole- Iftrue , also starts the interactive console thread viaMicroservice.startConsole().- Returns:
- The started
Microserviceinstance. - Throws:
Exception- Error occurred during bootstrap.
-
run
public static Microservice run(String[] args, WritableBeanStore beanStore, boolean startConsole, Class<?>... configurations) throws Exception Power-user form: boots a Jetty microservice with a caller-supplied bean store and configuration class list.Equivalent to writing the
Microservicebuilder chain by hand, but with the boilerplate collapsed. Use this when the simplerrun(String[], Servlet)overloads are too restrictive — e.g. multiple@Bean Servletcontributions, customMicroserviceListeners, or a parent bean store.- Parameters:
args- Themain(String[])arguments. Forwarded toMicroservice.Builder#args(String...).beanStore- The bean store to use for dependency injection. Pre-populated bean entries (@Bean Servlet,MicroserviceListener, etc.) are picked up byJettyConfigurationand the microservice runtime.startConsole- Iftrue , also starts the interactive console thread.configurations- The@Configuration-annotated classes to register. Always includesJettyConfiguration; pass an empty list to use only that.- Returns:
- The started
Microserviceinstance. - Throws:
Exception- Error occurred during bootstrap.
-