Microservice Jetty Overview
The Jetty Microservice API consists of a combination of the Juneau Core, Server, and Client APIs and an embedded Eclipse Jetty Servlet Container.
The API builds upon the juneau-microservice classes to produce easy-to-create and easy-to-use microservices in a standard Java 17+ environment.
Renamed in 10.0 —
juneau-microservice-coreis now published asjuneau-microservice. The Jetty module is no longer a subclass ofMicroservice; it contributes a single@Configurationclass (JettyConfiguration) that the user adds toMicroservice.Builder.configurations(...).
The juneau-microservice-jetty library consists of the following classes:
The most-basic creation of a Jetty microservice from an entry-point method is shown below:
public class App {
public static void main(String[] args) throws Exception {
Microservice
.create()
.args(args)
.configurations(JettyConfiguration.class, AppConfig.class)
.build()
.start()
.startConsole()
.join();
}
@Configuration
public static class AppConfig {
@Bean
Servlet rootResources() { return new RootResources(); }
}
}
RootResources (or any @Bean Servlet whose class is annotated with @Rest) is auto-mounted at the
path declared in @Rest(path = "...").
See also
- Microservice Overview — the core microservice, without Jetty