1.使用idea创建一个maven项目

点击file->new->project

springboot-helloworld编写springboot-helloworld编写

点击filsh

2.导入相关依赖

springboot-helloworld编写

点击pom.xml这个文件是maven导入jar包的配置文件

springboot-helloworld编写

如果是点的手动导入每次添加新的配置文件都需手动更新(点击import Changes),如果点的自动导入则会自动导入

3.编写springboot程序

目录结构

springboot-helloworld编写

新建以下目录结构

springboot-helloworld编写

HelloMain类

springboot-helloworld编写

HelloWorld类

springboot-helloworld编写

4.执行程序

springboot-helloworld编写

如果没有报错,在浏览器输入localhost:8080/hello出现以下界面,则表示程序执行成功

springboot-helloworld编写

相关文章: