set up java spring boot "hello world" web application on ubuntu from zero.

install JDK 8

$ sudo apt-get install openjdk-8-jdk

install Gradle

$ curl -s "" | bash
$ source "$HOME/.sdkman/bin/"
$ sdk install gradle 5.1.1

Spring Initializr
get your "" and unzip it.

choose "Gradle Project",
please remember add "Web" as dependence,
otherwise there will be compile errors.


Create a simple web application

$ cat src/main/java/com/example/demo/

package com.example.demo;

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

public class HelloController {

    public String index() {
        return "Greetings from Spring Boot!";


Run the Application

$ ./gradlew bootRun

Check out the service.

$ curl localhost:8080
Greetings from Spring Boot!

Generate IDE profile

add two plugin in build.gradle

apply plugin "idea"
apply plugin "eclipse"

generate IDE profile for IntelliJ IDEA(ipr)
./gradlew idea
generate IDE profile for Eclipse(.project)
./gradlew eclipse


Building an Application with Spring Boot

Subscribe to Post, Code and Quiet Time.

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.