[JAVA] Hello World with Eclipse + Spring Boot + Maven

Hello World with Spring Boot, so it's a procedure memo. Completed in Eclipse. It takes about 30 minutes.


Java7 Eclipse4.5 MARS Elipse plug-in version STS 3.8.3

Advance preparation

Please have STS installed in Eclipse. You don't need Tomcat.

Project creation

File → New → Other → Spring Starter Project Name "bootsample" Group "com.bootsample" Deliverable: "bootsample" Description: "Spring Boot Sample Project" Package: "com.bootsample"

Other than that, next by default → Check Web and complete

Configuration file description


No change Make sure that it looks like this:


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">


    <description>SpringBoot sample Project</description>

        <relativePath/> <!-- lookup parent from repository -->


Right-click on the boot project and do the following: ・ Maven → Project update → OK ・ Execute → Maven install

Check the main method

In the "com.bootsample" package in src / main / java Confirm that the Java class file "BootApplication.java" is created.


package com.bootsample;

import org.springframework.web.bind.annotation.SpringApplication;

public class BootApplication {

    public static void main(String[] args){

@SpringBootApplication is an important annotation that makes you recognize "I am a SpirngBoot project". Be sure to leave the main method as it will trigger the application to start.

Creating a controller

In the "com.bootsample" package in src / main / java Create a Java class file "HelloController.java". Please describe as follows.


package com.bootsample;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

public class HelloController {

    private String hello(){
        return "Hello world!!";

Make the class recognized as a controller by adding @RestController. @RequestMapping will be the URL at the time of access. This time, I access it with localhost: 8080 /, so I only use /.

Hello world !!

Right-click on the project and click Run → Spring Boot App to launch the application. If a character string such as ** Started Boot Application ** appears on the console, the startup is successful. Let's go to the world today. http://localhost:8080/

From the second time onward, you can also start and stop the server with the server start and stop buttons on the toolbar.

The great thing about Spring Boot

** Less description **

Java programs tend to get caught up in xml hell and library reincarnation, but Spring Boot is really easy to get rid of this area.

** Easy to implement **

** Thymeleaf ** that can be converted to JSP as HTML file, ** Spring Loaded ** that reflects the source at high speed, ** SprintBootActuator ** that can get the application status via WebAPI (localhost: 8080 / env) Spring selection convenient tools such as (usable) are collected. If Spring pom is described for each part, Spring Boot allows you to receive the library as pom all-in-one for each function. Of course, you can also pom individual parts.

Note here for Spring Boot

** Troublesome detailed version specification **

As a general rule, the Spring Boot library gets the latest library ** at that time. If you want to use an older version of springMVC only, you need to pom it separately, and the latest version cannot be removed from the dependency library. Dependency libraries also tend to be bloated.

** Create a jar file instead of a war file **

** Build will create a jar file **. You have to be careful about this. The strength of Spring Boot is that tomcat 8 is built into Spring Boot and it can be operated as it is, but if you want to run it in the existing Linux environment where Tomcat is installed, it will be a little troublesome. In some cases, you will have to disassemble the jar file once, extract tomcat8, and harden it with war again ... but that will kill the fun and speedy part of Spring Boot. It's a little thought.

** Requires understanding of Spring Framework **

Although it has been simplified in various ways, the mechanism is Spring after all. I think that those who have no experience with Spring need some learning costs. I think it's a little tough when it comes to Java beginners.


I think that it is difficult to operate in large-scale development, but I think that it can be used when you want to develop Java applications with a sense of speed. It is a framework that I want to be popular.

Recommended Posts

Hello World with Eclipse + Spring Boot + Maven
Hello World with Spring Boot
Hello World with Spring Boot!
Hello World with Spring Boot
Spring Boot Hello World in Eclipse
Until "Hello World" with Spring Boot
(Intellij) Hello World with Spring Boot
(IntelliJ + gradle) Hello World with Spring Boot
Hello world! With Spring Boot (Marven + text editor)
[Java] Hello World with Java 14 x Spring Boot 2.3 x JUnit 5 ~
Hello World (REST API) with Apache Camel + Spring Boot 2
Hello World (console app) with Apache Camel + Spring Boot 2
"Hello world" for ImageJ with Eclipse
Hello World with GWT 2.8.2 and Maven
[Practice! ] Display Hello World in Spring Boot
How Spring Security works with Hello World
Compare Hello, world! In Spring Boot with Java, Kotlin and Groovy
Hello World with Micronaut
Download with Spring Boot
Hello World at explosive speed with Spring Initializr! !! !!
Try to display hello world with spring + gradle
Spring Boot2 Web application development with Visual Studio Code Hello World creation
Include external jar in package with Spring boot2 + Maven3
Generate barcode with Spring Boot
Implement GraphQL with Spring Boot
Get started with Spring boot
Run LIFF with Spring Boot
SNS login with Spring Boot
Hello World with VS Code!
File upload with Spring Boot
Spring Boot starting with copy
Spring Boot starting with Docker
Until you start development with Spring Boot in eclipse 1
Set cookies with Spring Boot
Use Spring JDBC with Spring Boot
Add module with Spring Boot
Getting Started with Spring Boot
How to boot by environment with Spring Boot of Maven
Until you start development with Spring Boot in eclipse 2
Create microservices with Spring Boot
Send email with spring boot
Hello World with SpringBoot / Gradle
Hello World comparison between Spark Framework and Spring Boot
Hello, World! With Asakusa Framework!
Create a Hello World web app with Spring framework + Jetty
Use Basic Authentication with Spring Boot
gRPC on Spring Boot with grpc-spring-boot-starter
Create an app with Spring Boot 2
Hot deploy with Spring Boot development
Database linkage with doma2 (Spring boot)
Spring Boot programming with VS Code
Inquiry application creation with Spring Boot
Hello world with Kotlin and JavaFX
Hello World with Docker and C
Get validation results with Spring Boot
Hello World in java in eclipse now
Create an app with Spring Boot
Google Cloud Platform with Spring Boot 2.0.0
Check date correlation with Spring Boot
Hello World with GlassFish 5.1 + Servlet + JSP
Create PDF with itext7 ~ Hello World ~