[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 ...
随机推荐
- VS2015预览版中的C#6.0 新功能(一)
VS2015预览版中的C#6.0 新功能(二) VS2015预览版中的C#6.0 新功能(三) VS2015的预览版在11月12日发布了,下面让我们来看看C#都提供了哪些新的功能. 字符串添写(Str ...
- 如何利用自己的电脑做服务器发布tomcat的WEB项目供外网访问
1.首先你要确定你有一个外网ip地址.如果你分配到的是一个局域网IP地址需要经过一系列的转换为外网ip地址,然后继续下面操作. 2.拿到外网IP地址,进行tomcat的server.xml文件的配置. ...
- 在VS中如何用C++连接Mysql
在如鹏网上看到的如何用C连接Mysql,解决了大二时的一直困惑,大喜! 第一步下载 安装的数据库是如鹏网的Mysql :http://pan.baidu.com/s/1c0m3xIw 提取码:m9sn ...
- (转) Eclipse - Python - Installation of PyDev with a Python Hello World tutorial
Once you finished your installation of Python on your Windows OS, GNU/Linux or Mac OS, let me tell ...
- 反引号backtick中输入多个命令
如果在反引号backtick中输入多个命令会怎样?比如有如下脚本: #!/bin/bash var=`date;who` echo $var 运行该脚本,会发现输出的是命令date和who的集合,只是 ...
- canvas总结:元素大小与绘图表面大小
前言 我们使用canvas的时候一般在canvas元素中直接设置它的width和height: <canvas id="myCanvas" width="300&q ...
- 如何使用Assetic进行文件管理
安装和配置Assetic 从symfony2.8开始,Assetic就不再被包括在symfony标准版.使用任何Assetic的特性之前需要安装AsseticBundel,在命令行执行下面命令: $ ...
- wine下汉字方块解决
1.修改字体 首先,下载一个字体,例如win下的新宋体 其次, mkdir /usr/share/fonts/windows mv simsun.ttc /usr/share/fonts/window ...
- SqlServer sys.partition_view
--查看partition的四个视图 select * from sys.partition_functions--查看分区函数 select * from sys.partition_paramet ...
- javascript之String
一.构造函数 new String(value) //构造函数 function String(value) //转换函数 二.属性 length 该字符串中的字符数 var str = new St ...