网站首页 > 技术文章 正文
Spring Boot 概述:
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".
We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.
Spring Boot可以轻松创建独立的,生产级的基于Spring的应用程序,而你需要做的仅仅是run 这个项目。
Spring Boot 的设计是为了让你尽可能快的跑起来 Spring 应用程序并且尽可能减少你的配置文件。
Spring Boot特性:
- 创建独立运行的Spring应用程序
- 直接嵌入Tomcat,Jetty或Undertow(无需部署WAR文件)
- 提供starter简化maven配置
- 尽可能自动配置Spring和第三方库
- 提供准生产的应用监控功能,例如指标,运行状况检查
- 绝对没有代码生成,也不需要XML配置
- Spring Boot快速搭建web项目
Spring Boot项目搭建
- 访问:https://start.spring.io/,如下图所示(spring boot版本2.1.2,依赖了web)填写相关的项目信息、依赖等,就会生成一个maven项目的压缩包,下载解压
spring官网截图
- 打开idea,找到file-->open-->选择项目的路径,找打pom文件-->以project 形式打开
- idea导入截图
- 选择Open as Project截图
- 编写HelloController,放到包(com.example.helloSpringBoot.controller)下,HelloController代码如下:
package com.example.helloSpringBoot.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/hello")
public String HelloSpring (){
System.out.println("hello spring boot");
return "hello spring boot";
}
}
- 点击运行按钮,查看运行结果,截图如下:
- 运行按钮截图
- 运行日志截图
- 项目启动成功后,浏览器输入 http://localhost:8080/hello 访问,看到下面成功截图后,说明项目搭建成功
浏览器访问截图
欢迎关注我的微信公众号“Java碎碎念”,欢迎留言,一起学习,一起进步。
猜你喜欢
- 2024-10-09 用IDEA把SpringBoot项目打成jar发布项目
- 2024-10-09 SpringBoot 01 环境搭建入门(简单springboot项目搭建)
- 2024-10-09 IDEA中创建Springboot父子工程(idea创建父子项目)
- 2024-10-09 16:实现SpringBoot单个、多个文件的上传
- 2024-10-09 手把手教你用Spring-Boot搭建项目
- 2024-10-09 使用IDEA创建gradle的spring boot项目并提交到DS916+的git server上
- 2024-10-09 Springboot工程建立(springboot工程搭建步骤)
- 2024-10-09 SpringBoot进阶3:项目搭建方法与项目结构分析
- 2024-10-09 SpringBoot+Mybatis多模块(module)项目搭建教程
- 2024-10-09 这样做优化,实现 0.059s 启动一个SpringBoot项目
- 最近发表
-
- 聊一下 gRPC 的 C++ 异步编程_grpc 异步流模式
- [原创首发]安全日志管理中心实战(3)——开源NIDS之suricata部署
- 超详细手把手搭建在ubuntu系统的FFmpeg环境
- Nginx运维之路(Docker多段构建新版本并增加第三方模
- 92.1K小星星,一款开源免费的远程桌面,让你告别付费远程控制!
- Go 人脸识别教程_piwigo人脸识别
- 安卓手机安装Termux——搭建移动服务器
- ubuntu 安装开发环境(c/c++ 15)_ubuntu安装c++编译器
- Rust开发环境搭建指南:从安装到镜像配置的零坑实践
- Windows系统安装VirtualBox构造本地Linux开发环境
- 标签列表
-
- cmd/c (90)
- c++中::是什么意思 (84)
- 标签用于 (71)
- 主键只能有一个吗 (77)
- c#console.writeline不显示 (95)
- pythoncase语句 (88)
- es6includes (74)
- sqlset (76)
- apt-getinstall-y (100)
- node_modules怎么生成 (87)
- chromepost (71)
- flexdirection (73)
- c++int转char (80)
- mysqlany_value (79)
- static函数和普通函数 (84)
- el-date-picker开始日期早于结束日期 (76)
- js判断是否是json字符串 (75)
- c语言min函数头文件 (77)
- asynccallback (87)
- localstorage.removeitem (77)
- vector线程安全吗 (73)
- java (73)
- js数组插入 (83)
- mac安装java (72)
- 无效的列索引 (74)
