Skip to content

Microboot : Microserver and Spring Boot

johnmcclean-aol edited this page Dec 2, 2015 · 4 revisions

Both Microserver and Spring Boot making building and managing Spring apps simpler. But both make very different choices in how to do this, and thus do things very differently. Microserver is very focused on making Jersey as simple and powerful to use as possible, with full auto-discovery and subtle configuration options.

At Microserver we have really focused on integrating our opinionated core tech stack of Spring 4.x, Jersey 2.x, Grizzly, Guava, Codahale Metrics, Swagger and simple-react. And the good news is, if you want to use Microserver with Spring Boot you can. We love Spring, it is at the heart of Microserver. So in Mircoboot we've put Spring Boot the heart of Mircoserver. With Microboot you can run your Microserver applications, with Grizzly and Jersey configured as before, and you can continue to leverage Microserver patterns such as shared resource colocation with embedded Microservices.

One of the key differences between Microserver and Spring Boot is auto-configuration. In Microserver, auto-configuration is limited to the core tech stack. Going beyond that, to configure a datasource in Microserver you need to make an explicit decision and set a flag, with Spring Boot auto-configuration adding a jar to a classpath can be enough to fully auto-configure a new feature. This has both pros and cons - but you can choose. Not only between leveraging Spring 4.x through Microserver or Spring Boot, but by using them together through Microboot.

An Example Microboot app

@Microboot
@Path("/simple")
public class SimpleApp {

        public static void main(String[] args){
            new MicroserverApp(()->"test-app").run();
        }

        @GET
        public String ping() {
            return "ok";
        }
}

Microboot apps use the standard MicroserverApp class, in conjunction with the Microboot annotation to launch a full Jersey 2.x, Spring 4.x, Grizzly, Guava, SimpleReact app with all the usual Microserver options.