利用 Spring Initializr 快速创建SPB应用
Spring Initializr是Spring 官方的引用构建工具,Idea Ultimate版本默认对其支持
本节咱们学习Spring Boot应用的快速创建
学习视频: http://www.itlaoqi.com/chapter/1683.html
源码地址: QQ群 814077650 , 群共享中自助下载
老齐的官网: itlaoqi.com (更多干货就在其中)
操作流程
- Create new project
- 左侧选择Spring Initializr,右侧选中Default与Jdk8(含)以上即可
- 自定义Group/Artifact/Version, 其他默认即可
- web->web 增加Spring Boot starter web 启动器
Template-Engines -> 选中Thymeleaf ,模板引擎 - 工程创建成功,SPB标准目录结构与配置文件都默认被创建好了
- 创建测试用Controller
package com.qiyi.myspringboot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class MyController {
@RequestMapping("/out")
@ResponseBody
public String out(){
return "success";
}
}
- 运行XXXApplication,服务默认8080端口
- 浏览器访问localhost:8080/out
这篇博客介绍了如何利用Spring Initializr快速创建Spring Boot应用。通过Idea Ultimate的Spring Initializr支持,选择Default和Jdk8及以上版本,设置Group、Artifact和Version,添加web启动器和Thymeleaf模板引擎。创建完成后,Spring Boot的标准目录结构和配置文件自动生成,添加Controller并运行应用程序,服务可在8080端口访问。
383

被折叠的 条评论
为什么被折叠?



