Spring + Gradle + Java Quick Start

1. Obtaining a template

From here, download the template with the following settings.

Project: Gradle Project Language: Java Spring Boot: 2.1.4 Dependencies: Web

スクリーンショット 2019-04-23 14.06.49.png

2. Write a program

Create HelloController.java.

HelloController.java


package com.example.demo;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("hello")
public class HelloController {

    @GetMapping("")
    public String index(Model model) {
        return "Hello!!";
    }
}

3. Run

Click the green triangle in DemoApplication.java to execute. スクリーンショット 2019-04-23 14.12.12.png

Go to http: // localhost: 8080 / hello. スクリーンショット 2019-04-23 14.09.59.png

Recommended Posts

Spring + Gradle + Java Quick Start
Spring Java
[Java] Spring DI ③
Build Java x Spring x VSCode x Gradle on Docker (1)
Java tips-Create a Spring Boot project in Gradle
First gradle build (Java)
Java multi-project creation with Gradle
Java Config with Spring MVC
[Gradle] About Java plug-in tasks
Spring Boot 2 multi-project in Gradle
[Java] Thymeleaf Basic (Spring Boot)
[Java] Spring AOP execution order
CICS-Run Java application-(4) Spring Boot application
Using Mapper with Java (Spring)
Java tips --Spring execution Summary
[Java] How Spring DI works
Java8 to start now ~ Optional ~
Using Docker from Java Gradle
[Java] [Spring] Spring Boot 1.4-> 1.2 Downgrade Note
Spring Boot + Java + GitHub authentication login
◆ Spring Boot + gradle environment construction memo
Do HelloWorld in Java / IntelliJ / Gradle
Java Spring environment in vs Code
Elastic Beanstalk (Java) + Spring Boot + https
Java --Jersey Framework vs Spring Boot
Docker Gradle Quick Reference Japanese Translation
Implement reCAPTCHA v3 in Java / Spring
Spring Framework tools for Java developer
Java, interface to start from beginner
[Java] Spring DI ④ --Life cycle management
Implement Spring Boot application in Gradle
[Java] LINE integration with Spring Boot
Java, arrays to start with beginners
Java 8 ~ Stream API ~ to start now
Hello world in Java and Gradle
Spring Boot gradle build with Docker