Quick revision
The short answer
A Jakarta REST application can run on a full application server, which includes an implementation and scans for resources; on a servlet container such as Tomcat or Jetty with Jersey or RESTEasy added; inside Spring Boot with spring-boot-starter-jersey and a ResourceConfig bean; or standalone with the SeBootstrap API from Jakarta REST 3.1. @ApplicationPath on a subclass of Application sets the base URI under which all resources are served.
What to remember
In this answer, we separated the Jakarta REST API from its implementations and runtimes, and saw that @ApplicationPath on an Application subclass sets the base path under the context root, with an empty Application triggering scanning on a Jakarta EE server. On Tomcat or Jetty we add Jersey or RESTEasy ourselves, Spring Boot uses spring-boot-starter-jersey with a ResourceConfig bean and needs care alongside Spring MVC, Jakarta REST 3.1 added SeBootstrap for running without a container, and Quarkus uses its own build-time implementation.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
A Jakarta REST application can run on a full application server, which includes an implementation and scans for resources; on a servlet container such as Tomcat or Jetty with Jersey or RESTEasy added; inside Spring Boot with spring-boot-starter-jersey and a ResourceConfig bean; or standalone with the SeBootstrap API from Jakarta REST 3.1. @ApplicationPath on a subclass of Application sets the base URI under which all resources are served.
Why this question is asked
Knowing how a JAX-RS application starts explains many deployment surprises: why a WAR works on WildFly but returns 404 on Tomcat, why resources are found without being listed, and why two web frameworks fight over the same path in Spring Boot. Interviewers ask this concept question to check that we can tell the API from the implementation and the runtime. In this answer, we will recap that distinction, look at @ApplicationPath and scanning, then go through each way to bootstrap, and compare them in one table.
1A Quick Recap: API, Implementation and Runtime
Jakarta REST (formerly JAX-RS) is a specification: the jakarta.ws.rs annotations and interfaces such as @Path, @GET and Response. It does nothing on its own. An implementation, such as Jersey, RESTEasy or Quarkus REST, provides the engine that matches requests, calls our methods and serialises results. A runtime hosts that engine and owns the HTTP port: an application server, a servlet container, Spring Boot's embedded server, or a lightweight HTTP server. Every bootstrap option below is a different combination of these three.
2What @ApplicationPath Does
The Application class describes the application to the runtime. Annotating a subclass with @ApplicationPath sets the base path for every resource.
Notice that the full URL is context root, then application path, then resource path. With an empty Application on a Jakarta EE server, the server scans the deployment for classes annotated @Path and @Provider and registers them all. If we override getClasses() or getSingletons() to return a set, only those classes are registered, which is more explicit and avoids surprises when a library jar happens to contain a provider.
3On an Application Server
Jakarta EE servers such as WildFly, Payara, Open Liberty and GlassFish include a Jakarta REST implementation (RESTEasy in WildFly, Jersey in Payara and GlassFish) along with CDI, Bean Validation and JSON-B. We package a WAR with only our code, mark the dependency on the Jakarta EE API as provided, and the empty Application subclass is enough. This is the simplest bootstrap because the server does everything, at the cost of tying our runtime to the server's versions.
4On a Servlet Container With Jersey or RESTEasy
Tomcat and Jetty implement servlets, not Jakarta REST, so we bring the implementation ourselves. With Jersey we add jersey-container-servlet (plus an injection module such as jersey-hk2 and a JSON module), and either rely on its ServletContainerInitializer to pick up our @ApplicationPath class, or declare the servlet explicitly.
The reason this matters: dropping a WAR that worked on WildFly onto Tomcat without these dependencies gives 404s on every endpoint, because nothing in Tomcat knows what @Path means.
5In Spring Boot and Standalone
Spring Boot offers spring-boot-starter-jersey. We declare a ResourceConfig as a bean, register our resources, and Spring Boot runs Jersey as a servlet (or a filter) in the embedded server, with spring.jersey.application-path setting the base path. Resources can be Spring beans with injected dependencies. The catch is mixing Jersey with Spring MVC: both want to handle requests, so we give them separate paths, for example Jersey on /api and MVC for the actuator and web pages, or run Jersey as a filter that forwards unmatched requests to MVC. Check your Spring Boot version, since Jersey support depends on a compatible Jersey release.
Jakarta REST 3.1 added a Java SE bootstrap API, so an application can start with no container at all. SeBootstrap.start(app, config) picks an HTTP server supported by the implementation and returns a CompletionStage of a running instance. It is handy for tests and small tools.
| Runtime | Implementation comes from | How resources are found |
|---|---|---|
| Jakarta EE server | the server (RESTEasy, Jersey) | empty Application: scanning |
| Tomcat or Jetty | our WAR (jersey-container-servlet) | ResourceConfig.packages or getClasses |
| Spring Boot | spring-boot-starter-jersey | ResourceConfig bean, register() |
| Java SE | our classpath, SeBootstrap | the Application passed to start() |
| Quarkus | Quarkus REST | build-time indexing |
Quarkus is a different case again: it uses its own implementation, Quarkus REST (formerly RESTEasy Reactive), which processes the JAX-RS annotations at build time rather than at startup, which is a large part of why Quarkus starts fast and uses little memory.
6Follow-up questions
Which version of Jersey matches Jakarta EE 10 and 11?
Jakarta EE 10 includes Jakarta REST 3.1, implemented by Jersey 3.1.x and RESTEasy 6.2. Jakarta EE 11 includes Jakarta REST 4.0, implemented by Jersey 4.0 and RESTEasy 7. Jersey 2.x is the old javax.ws.rs line and Jersey 3.0 matched Jakarta EE 9. These pairings shift with patch releases, so check your version against the implementation's release notes.
Can one WAR contain two Application subclasses?
Yes, each with its own @ApplicationPath, for example /api and /admin, and each should then list its classes explicitly, because scanning would register every resource in both. It is a reasonable way to give the admin API different providers, such as stricter security filters.
Why might we choose explicit registration over scanning?
Scanning registers everything it finds, including providers that arrive inside a library jar, which can silently change JSON handling or add filters. Explicit registration makes the list of resources and providers visible in code and starts slightly faster, at the cost of remembering to add new classes.
7Conclusion
In this answer, we separated the Jakarta REST API from its implementations and runtimes, and saw that @ApplicationPath on an Application subclass sets the base path under the context root, with an empty Application triggering scanning on a Jakarta EE server. On Tomcat or Jetty we add Jersey or RESTEasy ourselves, Spring Boot uses spring-boot-starter-jersey with a ResourceConfig bean and needs care alongside Spring MVC, Jakarta REST 3.1 added SeBootstrap for running without a container, and Quarkus uses its own build-time implementation.
Open with
Jakarta REST is just the API, so how we bootstrap depends on where the implementation and the HTTP server come from. On a full Jakarta EE server like WildFly or Payara the implementation is built in: I write a subclass of jakarta.ws.rs.core.Application with @ApplicationPath, say slash api, and if it is empty the server scans for @Path and @Provider classes.
Then, if they want more
The application path sits between the context root and the resource path. On Tomcat or Jetty there is no JAX-RS at all, so I add Jersey's servlet container or RESTEasy's servlet initializer to the WAR, usually with a ResourceConfig that scans a package and registers JSON support; forgetting that gives 404s everywhere.
In Spring Boot I use spring-boot-starter-jersey and declare a ResourceConfig bean, and I am careful when Spring MVC is also present, giving them separate paths. Jakarta REST 3.1 added the SeBootstrap API, where SeBootstrap.start with an Application and a configuration starts a server without any container, which is nice for tests.
And Quarkus is its own thing, Quarkus REST, which was RESTEasy Reactive, and it processes the annotations at build time. For versions, Jakarta EE 10 is Jersey 3.1 and EE 11 is Jersey 4, but I would check the release notes.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- Jakarta EE 10, Jakarta EE 11, Jakarta EE 9
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Jakarta EE specifications
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "List the ways to bootstrap a Jakarta REST application: on an application server, on a...": https://scrivio-interview-library.netlify.app/java/jax-rs/a61d50d47e/