Because Console.log('Hello') Wasn’t Complicated Enough

Description : Okay, Let’s be real I tired out JavaScript and tired out Java previously in my LinkedIn series of DSA. But now writing code JavaScript code make me too bored to be honest. So, for backend code I thought to write to back with Java… no ...

the_OldSchool_coder
Because Console.log('Hello') Wasn’t Complicated Enough
  • Description :

Okay, Let’s be real I tired out JavaScript and tired out Java previously in my LinkedIn series of DSA. But now writing code JavaScript code make me too bored to be honest.

So, for backend code I thought to write to back with Java… no no no not Java. Let’s start with a Java based Backend framework that is highly scalable and high in efficiency.

In this part We are going to write production (Industry) grade , “Hello-World” in Spring Boot.


  • Dependency :

To write “Hello World” controller in Spring Boot .We first have to setup Spring boot application. So here is the multi-step process for making it :

  1. Install JDK in OS.
  1. Go to this Website.

  2. Configure this settings

  1. Click on generate .

  2. Unzip the Zip file.

  3. Open it in the VS code.


  • Writing ‘hello ayush’ :

  1. Seeing the Boilerplate :

    So, if you open src → main → java → com → ayush → quickstart. You can see

    In there you will see the code ie.

package com.ayush.quickstart;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class QuickstartApplication {

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

}
  1. Making Helloayush.java:

In which We have to write code . In this part or in this file We have to write the code .

package com.ayush.quickstart;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Helloayush {

    @GetMapping(path = "/hello")
    public String helloworld() {
        return "hello world";
    }
}

  • Running the Code :

If the codebase has MVNW then We can run this command .

./mvnw spring-boot:run

  • Seeing the Output :

So, After Writing the bash command in the terminal. We will see the output in the chrome at http://localhost.com/8080/hello. And here is a quick start to Spring Boot and from here. Your enterprise-grade Backend from “Hello World” is ready.


CTA :