Spring Boot官方文档学习——Spring Boot快速入门

1.Spring Boot简介

申明:本文创作基于当前Spring Boot最新RELEASE版本——1.5.10.RELEASE

    Spring Boot可以非常简单的创建一个独立的、生产级别的基于Spring的应用,你只管运行这个应用就好了。Spring boot仅需要非常少的配置。

    我们可以使用Spring Boot创建Java应用,将Java应用打包成jar,使用java -jar运行;也可以将应用打包成War,使用传统的web容器来发布应用。Spring Boot官方还提供了命令行工具来来运行Spring Boot开发的应用。

2.系统要求

    本文基于Spring Boot 1.5.10.RELEASE版本,至少需要Java7Spring Framework 4.3.14.RELEASE版本(更多版本请参考:https://projects.spring.io/spring-boot/)如果一定要用Java6开发,请移步这里。虽然Spring Boot支持Java6和Java7,但是官网推荐尽可能使用Java8。

3.内置的Servlet容器

以下内嵌servlet容器是开箱即用的

Name

Servlet Version

Java Version

Tomcat 8

3.1

Java 7+

Tomcat 7

3.0

Java 6+

Jetty 9.3

3.1

Java 8+

Jetty 9.2

3.1

Java 7+

Jetty 8

3.0

Java 6+

Undertow 1.3

3.1

Java 7+

4.如何安装Spring Boot

    Spring Boot可以与经典”Java开发工具一起使用,也可以作为命令行工具安装。 无论如何,您将需要Java SDK v1.6或更高版本。 在开始之前,您应该检查您当前的Java安装:java –version尽管Spring BootJava 1.6兼容,但如果可能的话,应该考虑使用最新版本的Java

4.1Java开发者安装指南

4.1.1使用Maven安装Spring Boot

    Spring BootApache Maven 3.2或更高版本兼容。 如果您还没有安装Maven,您可以按照 maven.apache.org上的说明进行操作。

    在许多操作系统上,Maven可以通过包管理器来安装。 如果您是OSX Homebrew用户,请尝试brew install maven安装mavenUbuntu用户可以运行sudo apt-get install maven

    Spring Boot依赖使用org.springframework.boot作为groupId。 通常,您的Maven POM文件将从spring-boot-starter-parent项目继承,并向一个或多个“Starter”声明依赖关系。 Spring Boot还提供了一个可选的Maven插件来创建可执行的jar文件。

典型的spring boot pom.xml的配置文件如下:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>myproject</artifactId>
    <version>0.0.1-SNAPSHOT</version>

<!-- Inherit defaults from Spring Boot -->
<!-- 继承Spring Boot的默认值 -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.10.RELEASE</version>
    </parent>

<!-- Add typical dependencies for a web application -->
   <!-- 为Web应用程序添加典型的依赖关系-->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

<!-- Package as an executable jar -->
<!-- 打包成可执行的jar文件 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

    spring-boot-starter-parent是使用Spring Boot的好方法,但它可能并不适合所有的情况。 有时您可能需要从不同的父POM继承,或者您可能不喜欢Spring Boot的默认设置。那么您也可以使用如下的方式配置Spring Boot POM

<dependencyManagement>
     <dependencies>
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.5.10.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

4.1.2使用Gradle安装Spring Boot

    Spring BootGradle 2 (2.9及以上) Gradle 3兼容。如果您还没有安装Gradle,可以按照www.gradle.org/.的步骤安装

    Spring Boot的依赖可以使用org.springframework.boot进行声明。您的项目可能会声明多个StartersSpring Boot提供了方便的Gradle插件以简化依赖和创建可执行的jar包。

    以下是典型的build.gradle文件:

plugins {
    id 'org.springframework.boot' version '1.5.10.RELEASE'
    id 'java'
}


jar {
    baseName = 'myproject'
    version =  '0.0.1-SNAPSHOT'
}

repositories {
    jcenter()
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile("org.springframework.boot:spring-boot-starter-test")
}

4.2安装Spring Boot CLI

    Spring Boot CLI是一个命令行工具,如果你想用Spring来快速创建原型,可以使用它。 它允许你运行Groovy脚本,这意味着你有一个熟悉的类Java语法,不需要太多的样板代码。您可能不需要使用CLI来使用Spring Boot,但它绝对是搭建Spring应用程序的最快捷方式。

手动安装

您可以从Spring软件存储库下载Spring CLI发行版

下载地址:

· spring-boot-cli-1.5.10.RELEASE-bin.zip

· spring-boot-cli-1.5.10.RELEASE-bin.tar.gz

的快照版本也是可用的。

    下载之后,请按照解压缩归档中的INSTALL.txt说明进行操作。 总结:在.zip文件的bin /目录下有一个spring脚本(适用于Windowsspring.bat),或者可以使用带有.jar文件的java -jar(该脚本可以帮助您确保类路径设置正确)。

INSTALL.txt文件内容如下:

SPRING BOOT CLI - INSTALLATION
==============================

Thank you for downloading the Spring Boot CLI tool. Please follow these instructions
in order to complete your installation.


Prerequisites
-------------
Spring Boot CLI requires Java JDK v1.6 or above in order to run. Groovy v2.4.13
is packaged as part of this distribution, and therefore does not need to be installed (any
existing Groovy installation is ignored).

The CLI will use whatever JDK it finds on your path, to check that you have an appropriate
version you should run:

	java -version

Alternatively, you can set the JAVA_HOME environment variable to point an suitable JDK.


Environment Variables
---------------------
No specific environment variables are required to run the CLI, however, you may want to
set SPRING_HOME to point to a specific installation.  You should also add SPRING_HOME/bin
to your PATH environment variable.


Shell Completion
----------------
Shell auto-completion scripts are provided for BASH and ZSH. Add symlinks to the appropriate
location for your environment. For example, something like:

  ln -s ./shell-completion/bash/spring /etc/bash_completion.d/spring
  ln -s ./shell-completion/zsh/_spring /usr/local/share/zsh/site-functions/_spring


Checking Your Installation
--------------------------
To test if you have successfully install the CLI you can run the following command:

	spring --version

我们来验证一下Spring Boot CLI的安装结果:

./spring --version
Spring CLI v1.5.10.RELEASE

5.创建你的第一个Spring Boot应用

开始之前,确保你已经安装了有效的JDKmaven版本

D:\code\first_spring_demo>java -version
java version "1.8.0_71"
Java(TM) SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot(TM) Client VM (build 25.71-b15, mixed mode, sharing)
D:\code\first_spring_demo>mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: D:\study\tools\maven\apache-maven-3.3.9\bin\..
Java version: 1.8.0_71, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jdk1.8.0_71\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "x86", family: "dos"

5.1创建POM文件

创建Maven需要的pom.xml文件。Maven将参照pom.xml创建您的项目

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <groupId>com.example</groupId>
   <artifactId>demo</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <packaging>jar</packaging>

   <name>demo</name>
   <description>Demo project for Spring Boot</description>
   <!-- Inherit defaults from Spring Boot 默认继承自Spring Boot -->
   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>1.5.10.RELEASE</version>
      <relativePath/> <!-- lookup parent from repository -->
   </parent>

   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
      <java.version>1.8</java.version>
   </properties>
</project>

    Spring Boot提供了许多“Starters”从而方便您添加额外的jar包到claspath下。spring-boot-starter-parent是一个提供了maven默认配置的特殊的starter。它还提供了一个依赖项管理部分,以便您可以省略依赖的第三方类库的版本号配置。

    配置好spring-boot-starter-parent后,我们执行以下mvn dependency:tree。可以发现spring-boot-starter-parent本身并不提供依赖。

D:\code\first_spring_demo>mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ demo ---
[INFO] com.example:demo:jar:0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.194 s
[INFO] Finished at: 2018-02-06T23:59:19+08:00
[INFO] Final Memory: 14M/33M
[INFO] ------------------------------------------------------------------------

5.2添加依赖

    当我们加入其他一些starter后,在观察一下mvn dependency:tree的执行结果:

<dependencies>
   <!-- 包含 mvc,aop 等jar资源 上边引入 parent,因此 下边无需指定版本-->
   <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
   </dependency>

   <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
   </dependency>
   <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <version>RELEASE</version>
   </dependency>
</dependencies>
D:\code\first_spring_demo>mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ demo ---
[INFO] com.example:demo:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter:jar:1.5.10.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:1.5.10.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-context:jar:4.3.14.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.10.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.10.RELEASE:compile
[INFO] |  |  +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] |  |  |  \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[INFO] |  +- org.springframework:spring-core:jar:4.3.14.RELEASE:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.10.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.5.10.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.10.RELEASE:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] |  |  +- net.minidev:json-smart:jar:2.2.1:test
[INFO] |  |  |  \- net.minidev:accessors-smart:jar:1.1:test
[INFO] |  |  |     \- org.ow2.asm:asm:jar:5.0.3:test
[INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] |  +- junit:junit:jar:4.12:test
[INFO] |  +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  \- org.springframework:spring-test:jar:4.3.14.RELEASE:test
[INFO] \- org.springframework.boot:spring-boot-starter-web:jar:1.5.10.RELEASE:compile
[INFO]    +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.10.RELEASE:compile
[INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.27:compile
[INFO]    |  |  \- org.apache.tomcat:tomcat-annotations-api:jar:8.5.27:compile
[INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.27:compile
[INFO]    |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.27:compile
[INFO]    +- org.hibernate:hibernate-validator:jar:5.3.6.Final:compile
[INFO]    |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO]    |  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
[INFO]    |  \- com.fasterxml:classmate:jar:1.3.4:compile
[INFO]    +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile
[INFO]    |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO]    |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile
[INFO]    +- org.springframework:spring-web:jar:4.3.14.RELEASE:compile
[INFO]    |  +- org.springframework:spring-aop:jar:4.3.14.RELEASE:compile
[INFO]    |  \- org.springframework:spring-beans:jar:4.3.14.RELEASE:compile
[INFO]    \- org.springframework:spring-webmvc:jar:4.3.14.RELEASE:compile
[INFO]       \- org.springframework:spring-expression:jar:4.3.14.RELEASE:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.752 s
[INFO] Finished at: 2018-02-07T00:01:42+08:00
[INFO] Final Memory: 17M/40M
[INFO] ------------------------------------------------------------------------

5.3编写代码

package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 落叶飞翔的蜗牛
 * @Date 2018/2/1
 * @Description
 */
@RestController
@EnableAutoConfiguration
public class SampleController {

    @RequestMapping("/hello")
    String hello() {
        return "Hello World!";
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(SampleController.class, args);
    }
}

5.3.1 @EnableAutoConfiguration注解

    由于spring-boot-starter-web包含了tomcat和SpringMVA,@EnableAutoConfiguration将会认为你正在开发一个web项目,并且已经正确的配置了Spring。

5.3.2 main方法

    我们的应用的最后一部分是一个main方法。这是一个标准的遵循Java规范的一个应用入口。我们的main方法委托SpringBootp的SringApplication类的run方法来执行。SpringApplication将会加载我们的应用,启动Spring和自动配置的默认tomcat容器。我们需要将我们的类SampleController当做参数传给SpringApplication类。

5.4运行我们的demo

在IDE中运行SampleController或者在终端上输入mvn spring-boot:run

"C:\Program Files (x86)\Java\jdk1.8.0_71\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:49157,suspend=y,server=n -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\rt.jar;D:\code\first_spring_demo\target\classes;D:\repository\org\springframework\boot\spring-boot-starter\1.5.10.RELEASE\spring-boot-starter-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot\1.5.10.RELEASE\spring-boot-1.5.10.RELEASE.jar;D:\repository\org\springframework\spring-context\4.3.14.RELEASE\spring-context-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.10.RELEASE\spring-boot-autoconfigure-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\1.5.10.RELEASE\spring-boot-starter-logging-1.5.10.RELEASE.jar;D:\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\repository\org\springframework\spring-core\4.3.14.RELEASE\spring-core-4.3.14.RELEASE.jar;D:\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\org\springframework\boot\spring-boot-starter-web\1.5.10.RELEASE\spring-boot-starter-web-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.10.RELEASE\spring-boot-starter-tomcat-1.5.10.RELEASE.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.27\tomcat-embed-core-8.5.27.jar;D:\repository\org\apache\tomcat\tomcat-annotations-api\8.5.27\tomcat-annotations-api-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.27\tomcat-embed-el-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.27\tomcat-embed-websocket-8.5.27.jar;D:\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;D:\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;D:\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;D:\repository\org\springframework\spring-web\4.3.14.RELEASE\spring-web-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.14.RELEASE\spring-aop-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.14.RELEASE\spring-beans-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-webmvc\4.3.14.RELEASE\spring-webmvc-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-expression\4.3.14.RELEASE\spring-expression-4.3.14.RELEASE.jar;D:\work\workspace2018\IntelliJ IDEA 2017.2.5\lib\idea_rt.jar" com.example.demo.SampleController
Connected to the target VM, address: '127.0.0.1:49157', transport: 'socket'

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.10.RELEASE)

2018-02-10 20:38:07.981  INFO 20400 --- [           main] com.example.demo.SampleController        : Starting SampleController on SC-201801141132 with PID 20400 (D:\code\first_spring_demo\target\classes started by Administrator in D:\code\first_spring_demo)
2018-02-10 20:38:07.996  INFO 20400 --- [           main] com.example.demo.SampleController        : No active profile set, falling back to default profiles: default
2018-02-10 20:38:08.299  INFO 20400 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@59191b: startup date [Sat Feb 10 20:38:08 CST 2018]; root of context hierarchy
2018-02-10 20:38:13.497  INFO 20400 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-02-10 20:38:13.534  INFO 20400 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-02-10 20:38:13.536  INFO 20400 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.27
2018-02-10 20:38:13.921  INFO 20400 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-02-10 20:38:13.921  INFO 20400 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5662 ms
2018-02-10 20:38:14.203  INFO 20400 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-02-10 20:38:14.208  INFO 20400 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-02-10 20:38:14.209  INFO 20400 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-02-10 20:38:14.209  INFO 20400 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-02-10 20:38:14.209  INFO 20400 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-02-10 20:38:14.969  INFO 20400 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@59191b: startup date [Sat Feb 10 20:38:08 CST 2018]; root of context hierarchy
2018-02-10 20:38:15.080  INFO 20400 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello]}" onto java.lang.String com.example.demo.SampleController.hello()
2018-02-10 20:38:15.084  INFO 20400 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-02-10 20:38:15.084  INFO 20400 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-02-10 20:38:15.149  INFO 20400 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-10 20:38:15.150  INFO 20400 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-10 20:38:15.225  INFO 20400 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-10 20:38:15.549  INFO 20400 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-02-10 20:38:15.738  INFO 20400 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-02-10 20:38:15.754  INFO 20400 --- [           main] com.example.demo.SampleController        : Started SampleController in 9.65 seconds (JVM running for 12.328)
2018-02-10 20:38:34.504  INFO 20400 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-02-10 20:38:34.504  INFO 20400 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2018-02-10 20:38:34.520  INFO 20400 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 16 ms

打开浏览器输入:http://localhost:8080/hello 观察浏览器


5.5创建可执行的jar包

    在本文的最后,我们创建一个可执行的jar包作为结束。

    可执行jar包有时候也称作“fat jars”。可执行jar包包含了您的编译后的代码和需要执行所要用到的其他jar包。

    我们需要在我们的pom文件中添加spring-boot-maven-plugin插件,以方便我们打可执行jar包。如下方式修改我们的pom.xml文件。

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

用IDE打包或者使用命令行mvn package 进行打包

"C:\Program Files (x86)\Java\jdk1.8.0_71\bin\java" -Dmaven.multiModuleProjectDirectory=D:\code\first_spring_demo -Dmaven.home=D:\study\tools\maven\apache-maven-3.3.9 -Dclassworlds.conf=D:\study\tools\maven\apache-maven-3.3.9\bin\m2.conf "-javaagent:D:\work\workspace2018\IntelliJ IDEA 2017.2.5\lib\idea_rt.jar=59411:D:\work\workspace2018\IntelliJ IDEA 2017.2.5\bin" -Dfile.encoding=UTF-8 -classpath D:\study\tools\maven\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2017.2.5 -s D:\study\tools\maven\apache-maven-3.3.9\conf\settings.xml -Dmaven.repo.local=D:\repository package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/springframework/boot/spring-boot-starter-web/maven-metadata.xml
Downloaded: http://maven.aliyun.com/nexus/content/groups/public/org/springframework/boot/spring-boot-starter-web/maven-metadata.xml (3 KB at 3.5 KB/sec)
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to D:\code\first_spring_demo\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\code\first_spring_demo\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\code\first_spring_demo\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ demo ---
[INFO] Surefire report directory: D:\code\first_spring_demo\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
21:19:32.243 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.example.demo.DemoApplicationTests]
21:19:32.262 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
21:19:32.270 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
21:19:32.285 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.example.demo.DemoApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
21:19:32.311 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.example.demo.DemoApplicationTests], using SpringBootContextLoader
21:19:32.314 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.demo.DemoApplicationTests]: class path resource [com/example/demo/DemoApplicationTests-context.xml] does not exist
21:19:32.314 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.demo.DemoApplicationTests]: class path resource [com/example/demo/DemoApplicationTestsContext.groovy] does not exist
21:19:32.315 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.example.demo.DemoApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
21:19:32.316 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.example.demo.DemoApplicationTests]: DemoApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
21:19:32.348 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.example.demo.DemoApplicationTests]
21:19:32.356 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemProperties' with lowest search precedence
21:19:32.356 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemEnvironment' with lowest search precedence
21:19:32.357 [main] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [MapPropertySource@9757992 {name='systemProperties', properties={idea.version=2017.2.5, java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin, java.vm.version=25.71-b15, java.vm.vendor=Oracle Corporation, java.vendor.url=http://java.oracle.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=CN, user.script=, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\code\first_spring_demo, java.runtime.version=1.8.0_71-b15, basedir=D:\code\first_spring_demo, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\endorsed, os.arch=x86, surefire.real.class.path=D:\code\first_spring_demo\target\surefire\surefirebooter7135873639111113958.jar, java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\, line.separator=
, java.vm.specification.vendor=Oracle Corporation, user.variant=, os.name=Windows 10, sun.jnu.encoding=GBK, java.library.path=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\Git\cmd;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\study\tools\maven\apache-maven-3.3.9\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin;., surefire.test.class.path=D:\code\first_spring_demo\target\test-classes;D:\code\first_spring_demo\target\classes;D:\repository\org\springframework\boot\spring-boot-starter\1.5.10.RELEASE\spring-boot-starter-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot\1.5.10.RELEASE\spring-boot-1.5.10.RELEASE.jar;D:\repository\org\springframework\spring-context\4.3.14.RELEASE\spring-context-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.10.RELEASE\spring-boot-autoconfigure-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\1.5.10.RELEASE\spring-boot-starter-logging-1.5.10.RELEASE.jar;D:\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\repository\org\springframework\spring-core\4.3.14.RELEASE\spring-core-4.3.14.RELEASE.jar;D:\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\repository\org\springframework\boot\spring-boot-starter-test\1.5.10.RELEASE\spring-boot-starter-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test\1.5.10.RELEASE\spring-boot-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test-autoconfigure\1.5.10.RELEASE\spring-boot-test-autoconfigure-1.5.10.RELEASE.jar;D:\repository\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;D:\repository\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;D:\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;D:\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\junit\junit\4.12\junit-4.12.jar;D:\repository\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;D:\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;D:\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;D:\repository\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;D:\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\repository\org\springframework\spring-test\4.3.14.RELEASE\spring-test-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-web\1.5.10.RELEASE\spring-boot-starter-web-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.10.RELEASE\spring-boot-starter-tomcat-1.5.10.RELEASE.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.27\tomcat-embed-core-8.5.27.jar;D:\repository\org\apache\tomcat\tomcat-annotations-api\8.5.27\tomcat-annotations-api-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.27\tomcat-embed-el-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.27\tomcat-embed-websocket-8.5.27.jar;D:\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;D:\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;D:\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;D:\repository\org\springframework\spring-web\4.3.14.RELEASE\spring-web-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.14.RELEASE\spring-aop-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.14.RELEASE\spring-beans-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-webmvc\4.3.14.RELEASE\spring-webmvc-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-expression\4.3.14.RELEASE\spring-expression-4.3.14.RELEASE.jar;, java.specification.name=Java Platform API Specification, java.class.version=52.0, sun.management.compiler=HotSpot Client Compiler, maven.repo.local=D:\repository, os.version=10.0, user.home=C:\Users\Administrator, user.timezone=Asia/Shanghai, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=GBK, java.specification.version=1.8, java.class.path=D:\code\first_spring_demo\target\test-classes;D:\code\first_spring_demo\target\classes;D:\repository\org\springframework\boot\spring-boot-starter\1.5.10.RELEASE\spring-boot-starter-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot\1.5.10.RELEASE\spring-boot-1.5.10.RELEASE.jar;D:\repository\org\springframework\spring-context\4.3.14.RELEASE\spring-context-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.10.RELEASE\spring-boot-autoconfigure-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\1.5.10.RELEASE\spring-boot-starter-logging-1.5.10.RELEASE.jar;D:\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\repository\org\springframework\spring-core\4.3.14.RELEASE\spring-core-4.3.14.RELEASE.jar;D:\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\repository\org\springframework\boot\spring-boot-starter-test\1.5.10.RELEASE\spring-boot-starter-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test\1.5.10.RELEASE\spring-boot-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test-autoconfigure\1.5.10.RELEASE\spring-boot-test-autoconfigure-1.5.10.RELEASE.jar;D:\repository\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;D:\repository\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;D:\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;D:\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\junit\junit\4.12\junit-4.12.jar;D:\repository\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;D:\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;D:\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;D:\repository\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;D:\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\repository\org\springframework\spring-test\4.3.14.RELEASE\spring-test-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-web\1.5.10.RELEASE\spring-boot-starter-web-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.10.RELEASE\spring-boot-starter-tomcat-1.5.10.RELEASE.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.27\tomcat-embed-core-8.5.27.jar;D:\repository\org\apache\tomcat\tomcat-annotations-api\8.5.27\tomcat-annotations-api-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.27\tomcat-embed-el-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.27\tomcat-embed-websocket-8.5.27.jar;D:\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;D:\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;D:\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;D:\repository\org\springframework\spring-web\4.3.14.RELEASE\spring-web-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.14.RELEASE\spring-aop-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.14.RELEASE\spring-beans-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-webmvc\4.3.14.RELEASE\spring-webmvc-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-expression\4.3.14.RELEASE\spring-expression-4.3.14.RELEASE.jar;, user.name=Administrator, java.vm.specification.version=1.8, sun.java.command=D:\code\first_spring_demo\target\surefire\surefirebooter7135873639111113958.jar D:\code\first_spring_demo\target\surefire\surefire2200616904128198414tmp D:\code\first_spring_demo\target\surefire\surefire_01869402885561491797tmp, java.home=C:\Program Files (x86)\Java\jdk1.8.0_71\jre, sun.arch.data.model=32, user.language=zh, java.specification.vendor=Oracle Corporation, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.8.0_71, java.ext.dirs=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext;C:\Windows\Sun\Java\lib\ext, sun.boot.class.path=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\rt.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\classes, java.vendor=Oracle Corporation, localRepository=D:\repository, file.separator=\, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86}}, SystemEnvironmentPropertySource@29341962 {name='systemEnvironment', properties={PATH=C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\Git\cmd;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\study\tools\maven\apache-maven-3.3.9\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin, USERDOMAIN_ROAMINGPROFILE=SC-201801141132, LOCALAPPDATA=C:\Users\Administrator\AppData\Local, PROCESSOR_LEVEL=6, SYSTEMDRIVE=C:, COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files, USERDOMAIN=SC-201801141132, FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer, LOGONSERVER=\\SC-201801141132, JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_71, PROMPT=$P$G, SESSIONNAME=Console, ALLUSERSPROFILE=C:\ProgramData, PROGRAMFILES(X86)=C:\Program Files (x86), PROCESSOR_ARCHITECTURE=x86, PROGRAMFILES=C:\Program Files (x86), APPDATA=C:\Users\Administrator\AppData\Roaming, MOZ_PLUGIN_PATH=D:\Program Files\fuxi\Foxit Reader\plugins\, PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules, PROGRAMW6432=C:\Program Files, PROGRAMDATA=C:\ProgramData, SYSTEMROOT=C:\Windows, USERNAME=Administrator, FPS_BROWSER_USER_PROFILE_STRING=Default, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC, OS=Windows_NT, PROCESSOR_ARCHITEW6432=AMD64, COMMONPROGRAMW6432=C:\Program Files\Common Files, COMPUTERNAME=SC-201801141132, COMMONPROGRAMFILES=C:\Program Files (x86)\Common Files, COMSPEC=C:\Windows\system32\cmd.exe, PROCESSOR_REVISION=4501, CLASSPATH=C:\Program Files (x86)\Java\jdk1.8.0_71\lib\dt.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\lib\tools.jar, WINDIR=C:\Windows, =D:=D:\code\first_spring_demo, HOMEPATH=\Users\Administrator, TEMP=C:\Users\ADMINI~1\AppData\Local\Temp, HOMEDRIVE=C:, PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel, USERPROFILE=C:\Users\Administrator, TMP=C:\Users\ADMINI~1\AppData\Local\Temp, #ENVTSLOGSHELLEXT2972=9095376, PUBLIC=C:\Users\Public, NUMBER_OF_PROCESSORS=4, =::=::\}}]
21:19:32.371 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved classpath location [com/example/demo/] to resources [URL [file:/D:/code/first_spring_demo/target/test-classes/com/example/demo/], URL [file:/D:/code/first_spring_demo/target/classes/com/example/demo/]]
21:19:32.372 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Looking for matching resources in directory tree [D:\code\first_spring_demo\target\test-classes\com\example\demo]
21:19:32.372 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Searching directory [D:\code\first_spring_demo\target\test-classes\com\example\demo] for files matching pattern [D:/code/first_spring_demo/target/test-classes/com/example/demo/*.class]
21:19:32.375 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Looking for matching resources in directory tree [D:\code\first_spring_demo\target\classes\com\example\demo]
21:19:32.375 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Searching directory [D:\code\first_spring_demo\target\classes\com\example\demo] for files matching pattern [D:/code/first_spring_demo/target/classes/com/example/demo/*.class]
21:19:32.376 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved location pattern [classpath*:com/example/demo/*.class] to resources [file [D:\code\first_spring_demo\target\test-classes\com\example\demo\DemoApplicationTests.class], file [D:\code\first_spring_demo\target\classes\com\example\demo\DemoApplication.class], file [D:\code\first_spring_demo\target\classes\com\example\demo\SampleController.class]]
21:19:32.439 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [D:\code\first_spring_demo\target\classes\com\example\demo\DemoApplication.class]
21:19:32.446 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.example.demo.DemoApplication for test class com.example.demo.DemoApplicationTests
21:19:32.452 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.example.demo.DemoApplicationTests]: using defaults.
21:19:32.455 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
21:19:32.466 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Could not instantiate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]
21:19:32.466 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Could not instantiate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
21:19:32.466 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@1416310, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@ab0bfb, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@955596, org.springframework.test.context.support.DirtiesContextTestExecutionListener@de0926, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@73b9ce, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@438a68, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@e5a13, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@39f68d, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@1bd940d, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@1d15f18]
21:19:32.469 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.demo.DemoApplicationTests]
21:19:32.469 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.demo.DemoApplicationTests]
Running com.example.demo.DemoApplicationTests
21:19:32.472 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.example.demo.DemoApplicationTests]
21:19:32.472 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
21:19:32.473 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
21:19:32.473 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.example.demo.DemoApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
21:19:32.475 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.example.demo.DemoApplicationTests], using SpringBootContextLoader
21:19:32.476 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.demo.DemoApplicationTests]: class path resource [com/example/demo/DemoApplicationTests-context.xml] does not exist
21:19:32.477 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.demo.DemoApplicationTests]: class path resource [com/example/demo/DemoApplicationTestsContext.groovy] does not exist
21:19:32.477 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.example.demo.DemoApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
21:19:32.478 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.example.demo.DemoApplicationTests]: DemoApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
21:19:32.497 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.example.demo.DemoApplicationTests]
21:19:32.497 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemProperties' with lowest search precedence
21:19:32.498 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemEnvironment' with lowest search precedence
21:19:32.498 [main] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [MapPropertySource@23963779 {name='systemProperties', properties={idea.version=2017.2.5, java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin, java.vm.version=25.71-b15, java.vm.vendor=Oracle Corporation, java.vendor.url=http://java.oracle.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=CN, user.script=, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\code\first_spring_demo, java.runtime.version=1.8.0_71-b15, basedir=D:\code\first_spring_demo, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\endorsed, os.arch=x86, surefire.real.class.path=D:\code\first_spring_demo\target\surefire\surefirebooter7135873639111113958.jar, java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\, line.separator=
, java.vm.specification.vendor=Oracle Corporation, user.variant=, os.name=Windows 10, sun.jnu.encoding=GBK, java.library.path=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\Git\cmd;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\study\tools\maven\apache-maven-3.3.9\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin;., surefire.test.class.path=D:\code\first_spring_demo\target\test-classes;D:\code\first_spring_demo\target\classes;D:\repository\org\springframework\boot\spring-boot-starter\1.5.10.RELEASE\spring-boot-starter-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot\1.5.10.RELEASE\spring-boot-1.5.10.RELEASE.jar;D:\repository\org\springframework\spring-context\4.3.14.RELEASE\spring-context-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.10.RELEASE\spring-boot-autoconfigure-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\1.5.10.RELEASE\spring-boot-starter-logging-1.5.10.RELEASE.jar;D:\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\repository\org\springframework\spring-core\4.3.14.RELEASE\spring-core-4.3.14.RELEASE.jar;D:\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\repository\org\springframework\boot\spring-boot-starter-test\1.5.10.RELEASE\spring-boot-starter-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test\1.5.10.RELEASE\spring-boot-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test-autoconfigure\1.5.10.RELEASE\spring-boot-test-autoconfigure-1.5.10.RELEASE.jar;D:\repository\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;D:\repository\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;D:\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;D:\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\junit\junit\4.12\junit-4.12.jar;D:\repository\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;D:\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;D:\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;D:\repository\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;D:\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\repository\org\springframework\spring-test\4.3.14.RELEASE\spring-test-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-web\1.5.10.RELEASE\spring-boot-starter-web-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.10.RELEASE\spring-boot-starter-tomcat-1.5.10.RELEASE.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.27\tomcat-embed-core-8.5.27.jar;D:\repository\org\apache\tomcat\tomcat-annotations-api\8.5.27\tomcat-annotations-api-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.27\tomcat-embed-el-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.27\tomcat-embed-websocket-8.5.27.jar;D:\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;D:\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;D:\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;D:\repository\org\springframework\spring-web\4.3.14.RELEASE\spring-web-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.14.RELEASE\spring-aop-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.14.RELEASE\spring-beans-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-webmvc\4.3.14.RELEASE\spring-webmvc-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-expression\4.3.14.RELEASE\spring-expression-4.3.14.RELEASE.jar;, java.specification.name=Java Platform API Specification, java.class.version=52.0, sun.management.compiler=HotSpot Client Compiler, maven.repo.local=D:\repository, os.version=10.0, user.home=C:\Users\Administrator, user.timezone=Asia/Shanghai, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=GBK, java.specification.version=1.8, java.class.path=D:\code\first_spring_demo\target\test-classes;D:\code\first_spring_demo\target\classes;D:\repository\org\springframework\boot\spring-boot-starter\1.5.10.RELEASE\spring-boot-starter-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot\1.5.10.RELEASE\spring-boot-1.5.10.RELEASE.jar;D:\repository\org\springframework\spring-context\4.3.14.RELEASE\spring-context-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.10.RELEASE\spring-boot-autoconfigure-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\1.5.10.RELEASE\spring-boot-starter-logging-1.5.10.RELEASE.jar;D:\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\repository\org\springframework\spring-core\4.3.14.RELEASE\spring-core-4.3.14.RELEASE.jar;D:\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\repository\org\springframework\boot\spring-boot-starter-test\1.5.10.RELEASE\spring-boot-starter-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test\1.5.10.RELEASE\spring-boot-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test-autoconfigure\1.5.10.RELEASE\spring-boot-test-autoconfigure-1.5.10.RELEASE.jar;D:\repository\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;D:\repository\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;D:\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;D:\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\junit\junit\4.12\junit-4.12.jar;D:\repository\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;D:\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;D:\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;D:\repository\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;D:\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\repository\org\springframework\spring-test\4.3.14.RELEASE\spring-test-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-web\1.5.10.RELEASE\spring-boot-starter-web-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.10.RELEASE\spring-boot-starter-tomcat-1.5.10.RELEASE.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.27\tomcat-embed-core-8.5.27.jar;D:\repository\org\apache\tomcat\tomcat-annotations-api\8.5.27\tomcat-annotations-api-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.27\tomcat-embed-el-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.27\tomcat-embed-websocket-8.5.27.jar;D:\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;D:\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;D:\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;D:\repository\org\springframework\spring-web\4.3.14.RELEASE\spring-web-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.14.RELEASE\spring-aop-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.14.RELEASE\spring-beans-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-webmvc\4.3.14.RELEASE\spring-webmvc-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-expression\4.3.14.RELEASE\spring-expression-4.3.14.RELEASE.jar;, user.name=Administrator, java.vm.specification.version=1.8, sun.java.command=D:\code\first_spring_demo\target\surefire\surefirebooter7135873639111113958.jar D:\code\first_spring_demo\target\surefire\surefire2200616904128198414tmp D:\code\first_spring_demo\target\surefire\surefire_01869402885561491797tmp, java.home=C:\Program Files (x86)\Java\jdk1.8.0_71\jre, sun.arch.data.model=32, user.language=zh, java.specification.vendor=Oracle Corporation, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.8.0_71, java.ext.dirs=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext;C:\Windows\Sun\Java\lib\ext, sun.boot.class.path=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\rt.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\classes, java.vendor=Oracle Corporation, localRepository=D:\repository, file.separator=\, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86}}, SystemEnvironmentPropertySource@28296041 {name='systemEnvironment', properties={PATH=C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\Git\cmd;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\study\tools\maven\apache-maven-3.3.9\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin, USERDOMAIN_ROAMINGPROFILE=SC-201801141132, LOCALAPPDATA=C:\Users\Administrator\AppData\Local, PROCESSOR_LEVEL=6, SYSTEMDRIVE=C:, COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files, USERDOMAIN=SC-201801141132, FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer, LOGONSERVER=\\SC-201801141132, JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_71, PROMPT=$P$G, SESSIONNAME=Console, ALLUSERSPROFILE=C:\ProgramData, PROGRAMFILES(X86)=C:\Program Files (x86), PROCESSOR_ARCHITECTURE=x86, PROGRAMFILES=C:\Program Files (x86), APPDATA=C:\Users\Administrator\AppData\Roaming, MOZ_PLUGIN_PATH=D:\Program Files\fuxi\Foxit Reader\plugins\, PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules, PROGRAMW6432=C:\Program Files, PROGRAMDATA=C:\ProgramData, SYSTEMROOT=C:\Windows, USERNAME=Administrator, FPS_BROWSER_USER_PROFILE_STRING=Default, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC, OS=Windows_NT, PROCESSOR_ARCHITEW6432=AMD64, COMMONPROGRAMW6432=C:\Program Files\Common Files, COMPUTERNAME=SC-201801141132, COMMONPROGRAMFILES=C:\Program Files (x86)\Common Files, COMSPEC=C:\Windows\system32\cmd.exe, PROCESSOR_REVISION=4501, CLASSPATH=C:\Program Files (x86)\Java\jdk1.8.0_71\lib\dt.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\lib\tools.jar, WINDIR=C:\Windows, =D:=D:\code\first_spring_demo, HOMEPATH=\Users\Administrator, TEMP=C:\Users\ADMINI~1\AppData\Local\Temp, HOMEDRIVE=C:, PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel, USERPROFILE=C:\Users\Administrator, TMP=C:\Users\ADMINI~1\AppData\Local\Temp, #ENVTSLOGSHELLEXT2972=9095376, PUBLIC=C:\Users\Public, NUMBER_OF_PROCESSORS=4, =::=::\}}]
21:19:32.498 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.example.demo.DemoApplication for test class com.example.demo.DemoApplicationTests
21:19:32.503 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.example.demo.DemoApplicationTests]: using defaults.
21:19:32.507 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
21:19:32.513 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Could not instantiate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]
21:19:32.514 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Could not instantiate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
21:19:32.514 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@ec1f8, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@1445d7f, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@396c1e, org.springframework.test.context.support.DirtiesContextTestExecutionListener@3f5566, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@405818, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@14c508a, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@b48321, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@b67034, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@267862, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@13da22c]
21:19:32.514 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.demo.DemoApplicationTests]
21:19:32.514 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.demo.DemoApplicationTests]
21:19:32.515 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.demo.DemoApplicationTests]
21:19:32.516 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.demo.DemoApplicationTests]
21:19:32.526 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@16be40f testClass = DemoApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@a50da testClass = DemoApplicationTests, locations = '{}', classes = '{class com.example.demo.DemoApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.SpringBootTestContextCustomizer@1ec318, org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@127982, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@f93f1, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@1df90b0], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]]], class annotated with @DirtiesContext [false] with mode [null].
21:19:32.527 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.demo.DemoApplicationTests]
21:19:32.527 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.demo.DemoApplicationTests]
21:19:32.599 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemProperties' with lowest search precedence
21:19:32.600 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemEnvironment' with lowest search precedence
21:19:32.604 [main] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [MapPropertySource@12935927 {name='systemProperties', properties={idea.version=2017.2.5, java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin, java.vm.version=25.71-b15, java.vm.vendor=Oracle Corporation, java.vendor.url=http://java.oracle.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=CN, user.script=, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\code\first_spring_demo, java.runtime.version=1.8.0_71-b15, basedir=D:\code\first_spring_demo, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\endorsed, os.arch=x86, surefire.real.class.path=D:\code\first_spring_demo\target\surefire\surefirebooter7135873639111113958.jar, java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\, line.separator=
, java.vm.specification.vendor=Oracle Corporation, user.variant=, os.name=Windows 10, sun.jnu.encoding=GBK, java.library.path=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\Git\cmd;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\study\tools\maven\apache-maven-3.3.9\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin;., surefire.test.class.path=D:\code\first_spring_demo\target\test-classes;D:\code\first_spring_demo\target\classes;D:\repository\org\springframework\boot\spring-boot-starter\1.5.10.RELEASE\spring-boot-starter-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot\1.5.10.RELEASE\spring-boot-1.5.10.RELEASE.jar;D:\repository\org\springframework\spring-context\4.3.14.RELEASE\spring-context-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.10.RELEASE\spring-boot-autoconfigure-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\1.5.10.RELEASE\spring-boot-starter-logging-1.5.10.RELEASE.jar;D:\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\repository\org\springframework\spring-core\4.3.14.RELEASE\spring-core-4.3.14.RELEASE.jar;D:\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\repository\org\springframework\boot\spring-boot-starter-test\1.5.10.RELEASE\spring-boot-starter-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test\1.5.10.RELEASE\spring-boot-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test-autoconfigure\1.5.10.RELEASE\spring-boot-test-autoconfigure-1.5.10.RELEASE.jar;D:\repository\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;D:\repository\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;D:\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;D:\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\junit\junit\4.12\junit-4.12.jar;D:\repository\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;D:\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;D:\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;D:\repository\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;D:\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\repository\org\springframework\spring-test\4.3.14.RELEASE\spring-test-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-web\1.5.10.RELEASE\spring-boot-starter-web-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.10.RELEASE\spring-boot-starter-tomcat-1.5.10.RELEASE.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.27\tomcat-embed-core-8.5.27.jar;D:\repository\org\apache\tomcat\tomcat-annotations-api\8.5.27\tomcat-annotations-api-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.27\tomcat-embed-el-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.27\tomcat-embed-websocket-8.5.27.jar;D:\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;D:\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;D:\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;D:\repository\org\springframework\spring-web\4.3.14.RELEASE\spring-web-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.14.RELEASE\spring-aop-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.14.RELEASE\spring-beans-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-webmvc\4.3.14.RELEASE\spring-webmvc-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-expression\4.3.14.RELEASE\spring-expression-4.3.14.RELEASE.jar;, java.specification.name=Java Platform API Specification, java.class.version=52.0, sun.management.compiler=HotSpot Client Compiler, maven.repo.local=D:\repository, os.version=10.0, user.home=C:\Users\Administrator, user.timezone=Asia/Shanghai, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=GBK, java.specification.version=1.8, java.class.path=D:\code\first_spring_demo\target\test-classes;D:\code\first_spring_demo\target\classes;D:\repository\org\springframework\boot\spring-boot-starter\1.5.10.RELEASE\spring-boot-starter-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot\1.5.10.RELEASE\spring-boot-1.5.10.RELEASE.jar;D:\repository\org\springframework\spring-context\4.3.14.RELEASE\spring-context-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.10.RELEASE\spring-boot-autoconfigure-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\1.5.10.RELEASE\spring-boot-starter-logging-1.5.10.RELEASE.jar;D:\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;D:\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;D:\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;D:\repository\org\springframework\spring-core\4.3.14.RELEASE\spring-core-4.3.14.RELEASE.jar;D:\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\repository\org\springframework\boot\spring-boot-starter-test\1.5.10.RELEASE\spring-boot-starter-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test\1.5.10.RELEASE\spring-boot-test-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-test-autoconfigure\1.5.10.RELEASE\spring-boot-test-autoconfigure-1.5.10.RELEASE.jar;D:\repository\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;D:\repository\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;D:\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;D:\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\repository\junit\junit\4.12\junit-4.12.jar;D:\repository\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;D:\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;D:\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;D:\repository\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;D:\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\repository\org\springframework\spring-test\4.3.14.RELEASE\spring-test-4.3.14.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-web\1.5.10.RELEASE\spring-boot-starter-web-1.5.10.RELEASE.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.10.RELEASE\spring-boot-starter-tomcat-1.5.10.RELEASE.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.27\tomcat-embed-core-8.5.27.jar;D:\repository\org\apache\tomcat\tomcat-annotations-api\8.5.27\tomcat-annotations-api-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.27\tomcat-embed-el-8.5.27.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.27\tomcat-embed-websocket-8.5.27.jar;D:\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;D:\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;D:\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;D:\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;D:\repository\org\springframework\spring-web\4.3.14.RELEASE\spring-web-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-aop\4.3.14.RELEASE\spring-aop-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-beans\4.3.14.RELEASE\spring-beans-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-webmvc\4.3.14.RELEASE\spring-webmvc-4.3.14.RELEASE.jar;D:\repository\org\springframework\spring-expression\4.3.14.RELEASE\spring-expression-4.3.14.RELEASE.jar;, user.name=Administrator, java.vm.specification.version=1.8, sun.java.command=D:\code\first_spring_demo\target\surefire\surefirebooter7135873639111113958.jar D:\code\first_spring_demo\target\surefire\surefire2200616904128198414tmp D:\code\first_spring_demo\target\surefire\surefire_01869402885561491797tmp, java.home=C:\Program Files (x86)\Java\jdk1.8.0_71\jre, sun.arch.data.model=32, user.language=zh, java.specification.vendor=Oracle Corporation, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.8.0_71, java.ext.dirs=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\ext;C:\Windows\Sun\Java\lib\ext, sun.boot.class.path=C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\rt.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\classes, java.vendor=Oracle Corporation, localRepository=D:\repository, file.separator=\, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86}}, SystemEnvironmentPropertySource@25929928 {name='systemEnvironment', properties={PATH=C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files\Git\cmd;C:\Program Files\MySQL\MySQL Utilities 1.6\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;D:\study\tools\maven\apache-maven-3.3.9\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\bin;C:\Program Files (x86)\Java\jdk1.8.0_71\jre\bin, USERDOMAIN_ROAMINGPROFILE=SC-201801141132, LOCALAPPDATA=C:\Users\Administrator\AppData\Local, PROCESSOR_LEVEL=6, SYSTEMDRIVE=C:, COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files, USERDOMAIN=SC-201801141132, FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer, LOGONSERVER=\\SC-201801141132, JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_71, PROMPT=$P$G, SESSIONNAME=Console, ALLUSERSPROFILE=C:\ProgramData, PROGRAMFILES(X86)=C:\Program Files (x86), PROCESSOR_ARCHITECTURE=x86, PROGRAMFILES=C:\Program Files (x86), APPDATA=C:\Users\Administrator\AppData\Roaming, MOZ_PLUGIN_PATH=D:\Program Files\fuxi\Foxit Reader\plugins\, PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules, PROGRAMW6432=C:\Program Files, PROGRAMDATA=C:\ProgramData, SYSTEMROOT=C:\Windows, USERNAME=Administrator, FPS_BROWSER_USER_PROFILE_STRING=Default, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC, OS=Windows_NT, PROCESSOR_ARCHITEW6432=AMD64, COMMONPROGRAMW6432=C:\Program Files\Common Files, COMPUTERNAME=SC-201801141132, COMMONPROGRAMFILES=C:\Program Files (x86)\Common Files, COMSPEC=C:\Windows\system32\cmd.exe, PROCESSOR_REVISION=4501, CLASSPATH=C:\Program Files (x86)\Java\jdk1.8.0_71\lib\dt.jar;C:\Program Files (x86)\Java\jdk1.8.0_71\lib\tools.jar, WINDIR=C:\Windows, =D:=D:\code\first_spring_demo, HOMEPATH=\Users\Administrator, TEMP=C:\Users\ADMINI~1\AppData\Local\Temp, HOMEDRIVE=C:, PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel, USERPROFILE=C:\Users\Administrator, TMP=C:\Users\ADMINI~1\AppData\Local\Temp, #ENVTSLOGSHELLEXT2972=9095376, PUBLIC=C:\Users\Public, NUMBER_OF_PROCESSORS=4, =::=::\}}]
21:19:32.606 [main] DEBUG org.springframework.core.env.MutablePropertySources - Adding PropertySource 'inline' with highest search precedence
21:19:32.613 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}
21:19:32.613 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'Inlined Test Properties' with highest search precedence

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.10.RELEASE)

2018-02-10 21:19:32.902  INFO 116 --- [           main] com.example.demo.DemoApplicationTests    : Starting DemoApplicationTests on SC-201801141132 with PID 116 (started by Administrator in D:\code\first_spring_demo)
2018-02-10 21:19:32.903  INFO 116 --- [           main] com.example.demo.DemoApplicationTests    : No active profile set, falling back to default profiles: default
2018-02-10 21:19:32.951  INFO 116 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Refreshing org.springframework.web.context.support.GenericWebApplicationContext@116132a: startup date [Sat Feb 10 21:19:32 CST 2018]; root of context hierarchy
2018-02-10 21:19:34.245  INFO 116 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.web.context.support.GenericWebApplicationContext@116132a: startup date [Sat Feb 10 21:19:32 CST 2018]; root of context hierarchy
2018-02-10 21:19:34.340  INFO 116 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello]}" onto java.lang.String com.example.demo.SampleController.hello()
2018-02-10 21:19:34.343  INFO 116 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-02-10 21:19:34.344  INFO 116 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-02-10 21:19:34.392  INFO 116 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-10 21:19:34.392  INFO 116 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-10 21:19:34.491  INFO 116 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-10 21:19:34.692  INFO 116 --- [           main] com.example.demo.DemoApplicationTests    : Started DemoApplicationTests in 2.05 seconds (JVM running for 2.888)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.367 sec - in com.example.demo.DemoApplicationTests
2018-02-10 21:19:34.840  INFO 116 --- [       Thread-3] o.s.w.c.s.GenericWebApplicationContext   : Closing org.springframework.web.context.support.GenericWebApplicationContext@116132a: startup date [Sat Feb 10 21:19:32 CST 2018]; root of context hierarchy

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ demo ---
[INFO] Building jar: D:\code\first_spring_demo\target\demo-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.10.RELEASE:repackage (default) @ demo ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.540 s
[INFO] Finished at: 2018-02-10T21:19:41+08:00
[INFO] Final Memory: 22M/53M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

观察执行后的效果:


可以发现已经生成一个jar包。下面我们执行命令行java -jar target/demo-0.0.1-SNAPSHOT.jar

Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation。保留所有权利。

D:\code\first_spring_demo> java -jar target/demo-0.0.1-SNAPSHOT.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.10.RELEASE)

2018-02-10 21:24:15.917  INFO 12808 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication v0.0.1-SNAPSHOT
on SC-201801141132 with PID 12808 (D:\code\first_spring_demo\target\demo-0.0.1-SNAPSHOT.jar started by Administrator in D:\code\first_spring_d
emo)
2018-02-10 21:24:15.940  INFO 12808 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to de
fault profiles: default
2018-02-10 21:24:16.087  INFO 12808 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.conte
xt.embedded.AnnotationConfigEmbeddedWebApplicationContext@514713: startup date [Sat Feb 10 21:24:16 CST 2018]; root of context hierarchy
2018-02-10 21:24:18.096  INFO 12808 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (ht
tp)
2018-02-10 21:24:18.122  INFO 12808 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-02-10 21:24:18.123  INFO 12808 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.
5.27
2018-02-10 21:24:18.419  INFO 12808 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicati
onContext
2018-02-10 21:24:18.420  INFO 12808 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initializatio
n completed in 2352 ms
2018-02-10 21:24:18.559  INFO 12808 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [
/]
2018-02-10 21:24:18.567  INFO 12808 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter'
 to: [/*]
2018-02-10 21:24:18.567  INFO 12808 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter'
to: [/*]
2018-02-10 21:24:18.567  INFO 12808 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter
' to: [/*]
2018-02-10 21:24:18.568  INFO 12808 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to
: [/*]
2018-02-10 21:24:18.935  INFO 12808 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.spring
framework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@514713: startup date [Sat Feb 10 21:24:16 CST 2018]; root of con
text hierarchy
2018-02-10 21:24:19.023  INFO 12808 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello]}" onto java.lang.String
 com.example.demo.SampleController.hello()
2018-02-10 21:24:19.027  INFO 12808 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.sprin
gframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorControl
ler.error(javax.servlet.http.HttpServletRequest)
2018-02-10 21:24:19.028  INFO 12808 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}"
onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servl
et.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-02-10 21:24:19.059  INFO 12808 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handle
r of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-10 21:24:19.059  INFO 12808 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of typ
e [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-10 21:24:19.104  INFO 12808 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto ha
ndler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-02-10 21:24:19.278  INFO 12808 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on sta
rtup
2018-02-10 21:24:19.402  INFO 12808 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-02-10 21:24:19.415  INFO 12808 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 4.274 seconds
(JVM running for 6.614)

验证完之后,按下ctrl + c 优雅的退出应用。

猜你喜欢

转载自blog.csdn.net/shixuetanlang/article/details/79306469