springboot-helloword 每天进步百分之一

1.eclipse 导入springboot插件
Eclipse — Help— Eclipse Marketplace
springboot-helloword 每天进步百分之一
查找选择如下图
springboot-helloword 每天进步百分之一
下载安装过程有点慢,也可手动下载安装,自行百度
安装完后重启eclipse即可使用
新建springboot项目
springboot-helloword 每天进步百分之一
springboot-helloword 每天进步百分之一
springboot-helloword 每天进步百分之一
springboot-helloword 每天进步百分之一
添加测试包和类
springboot-helloword 每天进步百分之一
运行
springboot-helloword 每天进步百分之一

右键项目名称,点击第一个运行,springboot内置tomcat,端口是8080
springboot-helloword 每天进步百分之一
启动后打印输出
springboot-helloword 每天进步百分之一
浏览器输入地址
http://localhost:8080/hello
效果图
springboot-helloword 每天进步百分之一
用随机端口启动服务器
前面提到过,此处的默认行为是启动服务器监听8080端口。在一台机器上一次只运行一个测
试的话,这没什么问题,因为没有其他服务器监听8080端口。但如果你和我一样,本机总是有其
他服务器在监听8080端口
让Spring Boot在随机选择的端口上启动服务器很方便。一种办法是将
server.port 属性设置为 0

相关文章: