[Spring Boot Reference Guide] 读书笔记一 Getting Started
8. Introducing Spring Boot
Goals of spring boot:
- Provide a radically faster and widely accessible getting started experience for all Spring development.
- Be opinionated out of the box, but get out of the way quickly as requirements start to diverge from the defaults.
- Provide a range of non-functional features that are common to large classes of projects (e.g. embedded servers, security, metrics, health checks, externalized configuration).
- Absolutely no code generation and no requirement for XML configuration.
9. System Requirements
Spring Boot集成了Tomcat、Jetty等Servlet 3.0+的Web容器。
10. Installing Spring Boot
Spring Boot以及Spring Boot CLI的各种安装方法
11. Developing your first Spring Boot application
1.
The spring-boot-starter-parent is a special starter that provides useful Maven defaults. It also provides a dependency-management section so that you can omit version tags for “blessed” dependencies.
spring-boot-starter-parent提供了所需的依赖,并且可以省略依赖的版本。
spring-boot-starter-web可以用来生成web程序,自带tomcat等。
2. 代码:
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*; @RestController // REST控制器,直接把字符串渲染后返回给调用者
@EnableAutoConfiguration // 自动配置
public class Example {
@RequestMapping("/") // 路由
String home() {
return "Hello World!";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Example.class, args);
}
}
通过以下命令启动
mvn spring-boot:run
[Spring Boot Reference Guide] 读书笔记一 Getting Started的更多相关文章
- Spring Boot Reference Guide
Spring Boot Reference Guide Authors Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch, ...
- 《spring boot 实战》读书笔记
前言:虽然已经用spring boot开发过一套系统,但是之前都是拿来主义,没有系统的,全面的了解过这套框架.现在通过学习<spring boot实战>这本书,希望温故知新.顺便实现自己的 ...
- 第64节:Java中的Spring Boot 2.0简介笔记
Java中的Spring Boot 2.0简介笔记 spring boot简介 依赖java8的运行环境 多模块项目 打包和运行 spring boot是由spring framework构建的,sp ...
- Spring boot 官网学习笔记 - Using Spring Boot without the Parent POM,但是还要使用Parent POM提供的便利
If you do not want to use the spring-boot-starter-parent, you can still keep the benefit of the depe ...
- Spring boot 官网学习笔记 - 开发第一个Spring boot web应用程序(使用mvn执行、使用jar执行)
Creating the POM <?xml version="1.0" encoding="UTF-8"?> <project xmlns= ...
- Spring boot 官网学习笔记 - logging
commons-logging和slf4j是java中的日志门面,即它们提供了一套通用的接口,具体的实现可以由开发者自由选择.log4j和logback则是具体的日志实现方案. 比较常用的搭配是com ...
- Spring boot 官网学习笔记 - Spring Boot 属性配置和使用(转)-application.properties
Spring Boot uses a very particular PropertySource order that is designed to allow sensible overridin ...
- Spring boot 官网学习笔记 - Spring DevTools 介绍
想要使用devtools支持,只需使用dependencies将模块依赖关系添加到你的构建中 运行打包的应用程序时,开发人员工具会自动禁用.如果你通过 java -jar或者其他特殊的类加载器进行启动 ...
- Spring boot 官网学习笔记 - Auto-configuration(@SpringBootApplication、@EnableAutoConfiguration、@Configuration)
Spring Boot auto-configuration attempts to automatically configure your Spring application based on ...
随机推荐
- SPOJ 4110 Fast Maximum Flow (最大流模板)
题目大意: 无向图,求最大流. 算法讨论: Dinic可过.终于我的常数还是太大.以后要注意下了. #include <cstdio> #include <cstring> # ...
- javascript中写不写$(function() {});的区别
原地址 $(document).ready() 里的代码是在页面内容都加载完才执行的,如果把代码直接写到script标签里,当页面加载完这个script标签就会执行里边的代码了,此时如果你标签里执行的 ...
- jquery.ajax和Ajax 获取数据
前几天接触了jquery 看到里面ajax的部分,自己也不是很懂,然后有重复看了即便,然后写了一个小功能,分享下...我刚学的.有错误的请指教. 验证用户名是否存在 在checkname_jqajax ...
- 关于Android Assets读取文件为File对象
关于Android Assets读取文件为File对象的问题,在Assets里面放置文件,在使用的时候,一般是使用AssetManger对象,open方法获取InputStream 然后进行其他操作. ...
- vim 常用快捷键 二[转]
键盘移动 (Move) 一切都从键盘的移动k -> 上 upj -> 下 downh -> 左 leftl -> 右 rightz -> 重画屏幕,当前光标变成屏幕的第一 ...
- python运维开发(十六)----Dom&&jQuery
内容目录: Dom 查找 操作 事件 jQuery 查找 筛选 操作 事件 扩展 Dom 文档对象模型(Document Object Model,DOM)是一种用于HTML和XML文档的编程接口.它 ...
- iOS Layer CABasicAnimation
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...
- bat加载和分离VHD
VHD: vhd:虚拟磁盘格式 [详看 百科 ] 应用: 建立VHD文件,把系统装进VHD,然后从VHD启动. 优点: 因为系统在一个文件里,所以有可删,可移动,可快照的优点. VHD装系统方法: 请 ...
- 瑞柏匡丞:App对新媒体的影响
当下App的迅猛发展是媒体进入开放平台时代的折射,作为最具新媒体特质的代表,App充满了社交性与交互性,并有效整合了传统媒体和新媒体的内容和服务.“什么是新媒体”——这个新媒体时代最为核心的命题,实际 ...
- 算法(Algorithm)是什么?
我们用煎蛋来打个比方.煎蛋的一般步骤是: 1.>取煎锅. 2.>取油. ->我们有油吗? ****有,把油倒入煎锅. ****没有,我们要去买油吗? #########要买,出去买油 ...