Servlet microservice - create

Below is shown simple creation of servlet microservice with Spring Boot. First step is to create single module structure which is described here. Then add classes shown below:

Configuration with controller

package com.example.springboot;

import com.jlupin.servlet.monitor.annotation.EnableJLupinSpringBootServletMonitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;

@Controller
@EnableAutoConfiguration
@EnableJLupinSpringBootServletMonitor
public class ExampleController {
    private final static Logger logger = LoggerFactory.getLogger(ExampleController.class);

    @RequestMapping("/")
    @ResponseBody
    String home() {
        logger.info("called home() method");
        return "Hello JLupin";
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(ExampleController.class, args);
    }
}

Read more about Spring Boot.

And that's all code you need to write. Go to next section to manually or automatically upload your microservice.