{8.0.0-new} Installing in Eclipse

Follow these instructions to create a new template project in Eclipse.

1. Download the my-springboot-microservice-{@property juneauVersion}.zip file from the downloads page (located in the binaries) and import it into your workspace as an existing project:
2. Select the archive file and import the project:
3. In your workspace, you should now see the following project:

The important elements in this project are:

- App.java - The entry point.
  This class creates and starts our microservice.
  Note that we're using the existing Spring Boot application logic for the microservice and we're retrieving our root resource as a spring bean.
  Only the top-level resource needs to be annotated with {@link oaj.rest.springboot.annotation.JuneauRestRoot @JuneauRestRoot}

  @SpringBootApplication @Controller public class App { public static void main(String[] args) { new SpringApplicationBuilder(App.class) .initializers(new JuneauRestInitializer(App.class)) .run(args); } @Bean @JuneauRestRoot public RootResources getRootResources() { return new RootResources(); } }

- RootResources.java - The top-level REST resource.
  This class routes HTTP requests to child resources.
  This is identical to the Jetty example.

  @Rest( path="/", title="My Microservice", description="Top-level resources page", htmldoc=@HtmlDoc( widgets={ ContentTypeMenuItem.class, StyleMenuItem.class }, navlinks={ "options: servlet:/?method=OPTIONS" } ), children={ HelloWorldResource.class, ConfigResource.class, LogsResource.class } ) public class RootResources extends BasicRestServletJenaGroup { // No code }

- juneau.cfg - The configuration file.
  Contains various useful settings.
  Can be used for your own resource configurations.
  Note that the Jetty configuration is not present.
  Also it's located in the classpath so that our microservice can be built as a single executable jar.

  #======================================================================================================================= # Basic configuration file for REST microservices # Subprojects can use this as a starting point. #======================================================================================================================= #======================================================================================================================= # REST settings #======================================================================================================================= [REST] # Comma-delimited list of key-value pairs that represent locations of static files that can be served up by your @Rest-annotated # classes. These are static files that are served up by the servlet under the specified sub-paths. # For example, given the following setting... # staticFiles = htdocs:my-docs,styles/my-styles # ...the URI "/servletPath/htdocs/javadoc.css" resolves to the path "/my-docs/javadoc.css". # This path can be relative to the working directory, classpath root, or package of your resource class. # Used by the BasicRestConfig interface that defines the following value: # staticFiles="$C{REST/staticFiles}" staticFiles = htdocs:htdocs # Stylesheet to use for HTML views. # Used by the BasicRestConfig interface that defines the following value: # stylesheet="$C{REST/theme,servlet:/htdocs/themes/devops.css}" theme = servlet:/htdocs/themes/devops.css # Various look-and-feel settings used in the BasicRestConfig interface. headerIcon = servlet:/htdocs/images/juneau.png headerLink = http://juneau.apache.org footerIcon = servlet:/htdocs/images/asf.png footerLink = http://www.apache.org favicon = $C{REST/headerIcon} header = <a href='$U{$C{REST/headerLink}}'> <img src='$U{$C{REST/headerIcon}}' style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/> </a> footer = <a href='$U{$C{REST/footerLink}}'> <img src='$U{$C{REST/footerIcon}}' style='float:right;padding-right:20px;height:32px'/> </a>

At this point, you're ready to start the microservice from your workspace.