Getting started with Spring Boot

by Hayri Cicek


Posted on 23-Jul-2018

With this tutorial I’ll show you how you can get started with Spring Boot.

Let’s get started!

The first thing to do is to navigate to start.spring.io, it is the place where you create your spring boot applications.

Group Id: com.kodnito
Artifact: Hello
Dependencies: Web
and click Generate Project.

Step 2 - Controller class
Create a simple rest controller class inside com.kodnito.hello.controllers package as follows.

HelloController.java

package com.kodnito.hello.controllers;

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

@RestController
public class HelloController {
    
    @GetMapping("/")
    public String helloSpringWorld() {
        return "Hello Spring World";
    }
}

Step 3 - Project structure
Review the final spring boot project structure.




Step 4 - Run application
Run the mvn spring-boot:run command, the console output will look like as follow.



Now, enter the http://localhost:8080 in browser's address bar and see the output.




Share this: