Springboot学习之Helloworld Springboot(idea编写)
刚开始学习springboot,从最简单的helloworld开始
网上查阅了很多博客,基本上都是缺少步骤的,现在记录一下自己搭建成功的详细步骤,带有截图
1、首先进入idea创建项目
选择Spring Initializr
选择Spring Initializr可以同时选择Project SDK,如下图
点击JDK选择你想要使用的jdk,如下图
我的电脑安装的jdk9,所以我选择的jdk9,然后点击OK,点击OK之后会回到下图的页面
点击next,进入如下画面填写相关项目信息,也可以默认下一步
点击next之后进入如下画面,
此处选择Web,如下图
然后next,再点击finish,之后,你就新建了一个springboot的项目了,项目结构如下图,
然后点击demo,新建一个controller包,
在controller包下面新建一个Helloworld,如下图
建完以后选择Helloworld,如图
然后你就可以在你的Helloworld文件内编写你的代码,代码如下
然后点击右上角的运行按钮运行程序,如图
程序运行如图所示
然后在浏览器输入localhost:8080/hello即可访问,如图
至此,一个简单的Springboot 的Hello World程序就完成了,如有不足还请大佬指出,不胜感激。