参考文档:eclipse https://jingyan.baidu.com/article/48206aea8b3570216bd6b310.html
idea https://blog.csdn.net/xdd19910505/article/details/77678699
eclipse版:
1.官网创建spring boot项目(也可以在eclipse配置插件sts创建)
打开网址:http://start.spring.io/
填写group和artifact等信息,单击生成项目,解压文件
2.使用ecplise导入maven项目
查看目录结构,发现会生成一个类,此类就是启动项目的类,里面有一个main方法,不用tomcat部署项目,直接启动运行。
3.添加核心依赖
pom.xml添加以下依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
4.配置访问端口(tomcat内嵌在项目中了)
在 application.properties 添加端口号
5.添加测试类测试
新建一个类型如下
6.启动
在启动类,右键 run java Application
浏览器输入地址 localhst:8081/test/hello
控制台会输出内容 "这是一个springboot项目!!!"
idea版
https://blog.csdn.net/xdd19910505/article/details/77678699