1. Download the basic framework
Website: https://start.spring.io/
All default, basically no change
The choice depends, of course, can add their own in pom.xml, we directly choose here.
Only select Spring Web Starter (can understand the next, Lombok, it is convenient when writing entity)
Click Generate the project -Ctrl +
Download will generate demo.zip
2.Maven install dependencies
Decompression demo.zip
Open a command-line tool in the demo directory (in the demo directory, hold down the shift key while clicking the right mouse button, click on the "open Powershell window here")
In the command line input (using the PowerShell command line mode)
mvn clean install '-Dmaven.test.skip=true'
If it is entered by cmd
mvn clean install -Dmaven.test.skip=true
3. Import eclipse
file->Import->Maven->Existing Maven Projects
Click Finish
4. encoding helloworld
The contents of the file instead DemoApplication.java
@SpringBootApplication @RestController public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } @RequestMapping("/") String home() { return "Hello World!"; } }
5.测试
在浏览器中访问地址:http://localhost:8080/
在此完成了springboot第一个helloworld程序。
github地址:https://github.com/Peng-star-star/spring-boot-demo-hello