SpringBoot for Microservices

Spring Boot is a framework module which provides RAD (Rapid Application Development) feature to the Spring framework. It is highly dependent on the starter templates feature which is very powerful and works flawlessly.

Spring Boot
Spring Boot

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”.We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.

Features :

  • Create stand-alone Spring applications
  • Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
  • Provide opinionated ‘starter’ dependencies to simplify your build configuration
  • Automatically configure Spring and 3rd party libraries whenever possible
  • Provide production-ready features such as metrics, health checks and externalized configuration
  • Absolutely no code generation and no requirement for XML configuration

Important Annotations :

  • @SpringBootApplication
  • @RestController
  • @Configuration
  • @EnableAutoConfiguration
  • @RequestMapping(value=”/”)
  • @ResponseBody
  • Etc…

Why we need SpringBoot ?

  • In microservice architecture, most of the companies are using Nodejs. Because it is a lightweight, open source, Highly scalable. But Node Js is single threaded. So, In that case, you can choose for your microservice.
  • Java & Spring framework both are Open-source.
  • Java is a multithreaded language.

Sample Spring Boot Project :


package Skeleton.demo;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.configurationprocessor.json.JSONObject;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

public class SkeletonApplication {
    public String status(){
        return "My First SpringBoot ;)";
    public static void main(String[] args) {
        SpringApplication.run(SkeletonApplication.class, args);


package Controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

 * @author Vivek Java
public class Status {
   public String hello() {
      return "Hello Spring Boot Learners";


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
		<relativePath/> <!-- lookup parent from repository -->
	<description>Demo project for Spring Boot</description>







server.port = 8000

In the above file, you can configure your port number based on your wish.

To Run :

  • Step 1: Install maven click here to see how
  • Go to the location where your pom.xml is present.
  • set the location in cmd
  • Run the command $ mvn clean install
  • After downloading all your dependencies build your spring-boot project. (Ex : C:\Users\Gopal.m2\repository\Skeleton\demo\0.0.1-SNAPSHOT)
  • In the above location, my demo-0.0.1-SNAPSHOT.jar was build successfully.
  • Now using the command you can start your spring boot project $java -jar demo-0.0.1-SNAPSHOT.jar.
  • Now Your SpringBoot Microservice is running on port 8000

Download Source Code :

Sample project

Common Issues :

Why does my Spring Boot App always shutdown immediately after starting?

Solution : add the below code in your pom.xml


****** BEST OF LUCK *******

Try Another program: Nightwatch.js

You may also like...