Atharva Siddhabhatti
Atharva Siddhabhatti's Blog


Atharva Siddhabhatti's Blog

Hello World in Spring Boot

Hello World in Spring Boot

Atharva Siddhabhatti's photo
Atharva Siddhabhatti
·Oct 12, 2021·

1 min read

Clone the repository from here Click Here


Import Maven based project in any of your Favourite IDE.

./mvnw spring-boot:run


Open in Browser



helloWorld() method returning a string "Hello World". The @GetMapping annotation is used to handle the GET request with the URI provided. It is a different version of @RequestMapping specifically for the GET Request.

    public String helloWorld() {
        return "Hello World";

helloWorldBean() method returning a bean with string parameter "Hello World". The bean is nothing but the instance object which are managed by the spring container. These beans are kind of stored at a one place like bag of beans from where they are accessed whenever required. The object created by the container are called beans.

    public HelloWorldBean helloWorldBean() {
        return new HelloWorldBean("Hello World");

helloWorld1() method printing Hello World, 'name' using @PathVariable annotation. The @PathVariable annotation is used to extract the parameter value from the URI provided in this case name is being extracted from the URI and then it is called by the HelloWorldBean.

    public HelloWorldBean helloWorl1(@PathVariable String name) {
        return new HelloWorldBean(String.format("Hello World, %s", name));



Share this