{title:'Deployment', updated:'9.0.0'}

REST resources are deployed in the following ways:

When deployed in a J2EE container, you MUST extend from one of the servlet classes.

Deployment in a servlet container is typically done by adding a servlet entry for the top-level resources to the JEE web.xml.

Deployment in a Spring Boot environment involves defining your top-level resources as Spring Beans. Top-level resources must extend from {@link oajr.springboot.BasicSpringRestServlet} or {@link oajr.springboot.BasicSpringRestServletGroup} so that Juneau can hook into the injection framework provided by Spring. Child resource CAN be defined as injected Spring Beans as well but it is not a requirement.

Example Spring Boot Configuration

| @SpringBootApplication | @Controller | public class SpringBootAppConfig { | | @Bean | public MyRootResources getRootResources() { | ... | } | | @Bean | public MyChildResource getMyChildResource() { | ... | } | | @Bean | public ServletRegistrationBean<Servlet> getRootServlet(RootResources rootResources) { | return new ServletRegistrationBean<>(rootResources, "/*"); | } | }