Spring5学习(二)-spring projects之Spring Boot

来源:互联网 发布:淘宝机箱定制线哪家好 编辑:程序博客网 时间:2024/06/03 18:30

Spring Boot

Takes an opinionated view(固执己见) of building production-ready(生产就绪) Spring applications. Spring Boot favors(关心) convention over configuration(约定优于配置) and is designed to get you up and running as quickly as possible.

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.


Features

Create stand-alone Spring applications
Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
Provide opinionated(<贬>固执己见的,武断的;自用;师心自用) 'starter' POMs to simplify your Maven configuration
Automatically(自动) configure Spring whenever(无论何时) possible
Provide production-ready features such as metrics(度量), health checks and externalized(使客观化) configuration
Absolutely no code generation andno requirement for XML configuration

The reference guide includes detailed descriptions of all the features, plus an extensive(广泛的)howtofor common use cases.


Quick Start

If you are Java developer you can use start.spring.ioto generate a basic project, follow the "Quick Start" example below, or read the reference documentationgetting started guide.

The recommended way to get started using spring-boot in your project is with a dependency management system – the snippet below can be copied and pasted into your build. Need help? See our getting started guides on building with Maven and Gradle.

version: 1.5.8  Reference API

Maven:

<parent>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-parent</artifactId>    <version>1.5.8.RELEASE</version></parent><dependencies>    <dependency>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter-web</artifactId>    </dependency></dependencies>
Gradle:

dependencies {    compile("org.springframework.boot:spring-boot-starter-web:1.5.8.RELEASE")}
hello/SampleController.java

package hello;import org.springframework.boot.*;import org.springframework.boot.autoconfigure.*;import org.springframework.stereotype.*;import org.springframework.web.bind.annotation.*;@Controller@EnableAutoConfigurationpublic class SampleController {    @RequestMapping("/")    @ResponseBody    String home() {        return "Hello World!";    }    public static void main(String[] args) throws Exception {        SpringApplication.run(SampleController.class, args);    }}

Spring Boot CLI

Spring Boot ships with a command line tool that can be used if you want to quickly prototype(原型,雏形,蓝本) with Spring. It allows you to run Groovy scripts, which means that you have a familiar Java-like syntax(语法;句法;句法规则[分析];语构), without so much boilerplate(样板文件;公式化,陈词滥调) code. Follow the instructions in our main documentation if you want toinstall the Spring Boot CLI.




说明:

1. Undertow:Undertow 是红帽公司(RedHat)的开源产品,是 WildFly8(JBoos) 默认的 Web 服务器。Undertow是一个用java编写的灵活的高性能Web服务器,提供基于NIO的阻塞和非阻塞API。(来自:csdn blogs)

2. GA:General Availability(正式发布的版本)在国外都是用GA来说明release版本的

3. RELEASE DOCUMENTATION
2.0.0 M6 ReferenceAPI
2.0.0 ReferenceAPI
1.5.9 ReferenceAPI
1.5.8 ReferenceAPI
1.4.7 ReferenceAPI


原创粉丝点击