[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. 代码:

 1 import org.springframework.boot.*;
 2 import org.springframework.boot.autoconfigure.*;
 3 import org.springframework.stereotype.*;
 4 import org.springframework.web.bind.annotation.*;
 5
 6 @RestController // REST控制器,直接把字符串渲染后返回给调用者
 7 @EnableAutoConfiguration // 自动配置
 8 public class Example {
 9     @RequestMapping("/") // 路由
10     String home() {
11         return "Hello World!";
12     }
13     public static void main(String[] args) throws Exception {
14         SpringApplication.run(Example.class, args);
15     }
16 }

通过以下命令启动

mvn spring-boot:run
时间: 2024-08-05 18:54:06

[Spring Boot Reference Guide] 读书笔记一 Getting Started的相关文章

(Molehill) Game Programming Beginner's Guide 读书笔记 chapter2

-- chapter2. //23.-- Blueprint of a MolehillStage3D objects are not inside the DisplayList in Flash!As they are not DisplayObjects, you cannot apply filters or blendmodes. You cannot even put a Stage3D object over the top of other Flash 2D graphics!

spring boot Websocket(使用笔记)

本文只作为个人笔记,大部分代码是引用其他人的文章的. 在springboot项目中使用websocket做推送,虽然挺简单的,但初学也踩过几个坑,特此记录. 使用websocket有两种方式:1是使用sockjs,2是使用h5的标准.使用Html5标准自然更方便简单,所以记录的是配合h5的使用方法. 1.pom 核心是@ServerEndpoint这个注解.这个注解是Javaee标准里的注解,tomcat7以上已经对其进行了实现,如果是用传统方法使用tomcat发布项目,只要在pom文件中引入j

spring boot 文档学习笔记day01

1.在pom.xml中使用spring-boot-starter-parent的作用: Maven users can inherit from the spring-boot-starter-parent project to obtain sensible defaults. The parent project provides the following features: Java 1.8 as the default compiler level. UTF-8 source enco

spring技术核心_读书笔记_01简介

1.spring的目标 简化Java企业应用的开发是spring框架的目标. 为开发者提供一个一站式的轻量级的应用开发框架(平台). 2.spring的期望 希望能够集成管理企业应用资源,为应用开发提供平台支持. 如何为开发者集中管理在Java企业应用和Web应用中涉及的数据持久化.事务处理.消息中间件.分布式计算等抽象资源, 并在此基础上,为应用提供一个基于POJO的开发环境. 3.分为三部分 核心.组件.应用 spring架构图 spring Aop spring事务处理 spring应用

《spring技术内幕》读书笔记——什么是POJO模式

今天在看<spring技术内幕>,第一章中多次提到了使用POJO来完成开发,就百度了一下,在此保留 1.     什么是POJO POJO的名称有多种,pure old java object .plain ordinary java object 等. 按照Martin Fowler的解释是“Plain Old Java Object”,从字面上翻译为“纯洁老式的java对象”,但大家都使用“简单java对象”来称呼它. POJO的内在含义是指那些没有从任何类继承.也没有实现任何接口,更没有

使用Spring Boot来加速Java web项目的开发

使用Spring Boot来加速Java web项目的开发 我想,现在企业级的Java web项目应该或多或少都会使用到Spring框架的. 回首我们以前使用Spring框架的时候,我们需要首先在(如果你使用Maven的话)pom文件中增加对相关的的依赖(使用gradle来构建的话基本也一样)然后新建Spring相关的xml文件,而且往往那些xml文件还不会少.然后继续使用tomcat或者jetty作为容器来运行这个工程.基本上每次创建一个新的项目都是这么一个流程,而我们有时候仅仅想快速的创建一

Spring boot打包为可部署在tomcat下运行的war文件的方法(使用Gradle、Intellij IDEA)

使用Gradle: dependencies { compile("org.springframework.boot:spring-boot-starter-web") providedCompile("org.springframework.boot:spring-boot-starter-tomcat")//此处使用providedCompile,则生成的jar包可放入tomcat内运行// compile("org.springframework.b

Spring Boot实践教程(一):Hello,world!

??本篇会通过完成一个常用的Helloworld示例,来开始我们的Spring Boot旅程 准备工作 15分钟 开发环境 项目创建 ??项目创建的时候我们可以选择通过自定义配置Maven文件来创建,也可以用Spring官方提供的Spring Initializr工具,Spring Initializr是一个可以简化Spring Boot项目构建的工具,有两种使用Spring Initializr的方法: 官方提供的web页面工具,地址 开发工具集成的方式 ??两种方式操作的步骤是一样的,只不过

spring boot 实战 / mvn spring-boot:run 参数详解

概述   Spring boot项目通常情况下有如下几种启动方式: 通过主类启动. 通过spring-boot的maven插件spring-boot-maven-plugin方式启动. 通过可执行jar/war包方式启动. 通过Servlet容器启动,如Tomcat.Jetty等.   今天我们来聊一下spring boot的maven插件spring-boot-maven-plugin启动过程中的profiles问题.首先,我们前往网站SPRING INITIALIZR,参照下图创建一个名称为