install JDK 8
$ sudo apt-get install openjdk-8-jdkinstall Gradle
$ curl -s "https://get.sdkman.io" | bash$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk install gradle 5.1.1
Spring Initializr
start.spring.ioget your "demo.zip" 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/HelloController.java
package com.example.demo;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
@RestController
public class HelloController {
@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}
}
Run the Application
$ ./gradlew bootRunCheck out the service.
$ curl localhost:8080Greetings from Spring Boot!
Generate IDE profile
add two plugin in build.gradleapply plugin "idea" apply plugin "eclipse"
generate IDE profile for IntelliJ IDEA(ipr)./gradlew idea
generate IDE profile for Eclipse(.project)
./gradlew eclipse