Eclipse --Springboot

environment

Put STS in Eclipse

Install Spring Tools 4

--Find STS4 in the Eclipse market and press install
image.png --Press Confirm
image.png --Select "I accept the terms of the Terms of Use" and press Finish
image.png --Press Restart Now to restart Eclipse
image.png

View Eclipse perspective

--Select "Window-> Perspective-> Open Perspective-> Other" from the menu
image.png --Select Spring and press Open
image.png --Select Spring from the perspective
image.png

Project creation

--Select the menu "File-> New-> Spring Starter Project" --Press Next
image.png --Add a dependency and press Finish
image.png --Wait for dependency import
image.png --If you get an unknown error in the first line of pom.xml, add the version specification of maven plugin.

pom.xml


	<properties>
            <java.version>1.8</java.version> 
            <!--Add the line below-->  
            <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
	</properties>

Operation check

Create a Controller

HelloController.java



package com.example.demo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HelloContoller {

	@RequestMapping("/")
	public String hello() {
		return "hello";
	}
}

Create HTML

hello.html


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Spring demo</title>
</head>
<body>
  <h1>Hello</h1>
</body>
</html>

Select "Run-> Spring boot application" from the toolbar execution to access "http: // localhost: 8080"

image.png

Recommended Posts

Eclipse --Springboot
Eclipse error
SpringBoot 2.0 multi-project build
Eclipse snippets / templates
Eclipse trick memo
eclipse shortcut table
VisualStudioCode + Java + SpringBoot
My Eclipse Tips
eclipse installation procedure
MVC in Eclipse.
Eclipse refactoring summary
Docker + Spring-boot start
Until building Spring-Boot using Eclipse on Mac (Gradle version)