一.Spring Boot简介

官网地址:http://spring.io/projects/spring-boot

Spring Boot可以轻松创建可以运行的独立的,生产级的基于Spring的应用程序。我们对Spring平台和第三方库进行了一种自以为是的观点,这样您就可以轻松上手了。大多数Spring Boot应用程序只需要很少的Spring配置。

您可以使用Spring Boot创建可以使用java -jar或更传统的war部署启动的Java应用程序 。我们还提供了一个运行“spring脚本”的命令行工具。

我们的主要目标是:

  • 为所有Spring开发提供从根本上更快且可广泛访问的入门体验。
  • 开箱即用,但随着需求开始偏离默认值而迅速摆脱困境。
  • 提供大型项目(例如嵌入式服务器,安全性,度量标准,运行状况检查和外部化配置)通用的一系列非功能性功能。
  • 绝对没有代码生成,也不需要XML配置。

背景:

J2EE笨重的开发、繁多的配置、低下的开发效率、复杂的部署流程、第三方技术集成难度大。

优点:

快速创建独立运行的Spring项目以及与主流框架集成

使用嵌入式的Servlet容器,应用无需打成WAR包

starters自动依赖与版本控制

大量的自动配置,简化开发,也可修改默认值

无需配置XML,无代码生成,开箱即用

准生产环境的运行时应用监控

与云计算的天然集成

解决:

“Spring全家桶”时代。Spring Boot à J2EE一站式解决方案Spring Cloud à 分布式整体解决方。

单体应用

微服务

二.Spring Boot入门

1. 环境准备

jdk1.8

maven3.x

IntelliJ IDEA 2018

Spring Boot 2.0.5.RELEASE需要Java 8或9以及 Spring Framework 5.0.9.RELEASE或更高版本。

Spring Boot文档参考指南 :https://docs.spring.io/spring-boot/docs/2.0.5.RELEASE/reference/htmlsingle/#getting-started-system-requirements-servlet-containers

2. 创建maven项目

编辑pom.xml文件,引入相关依赖

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.</modelVersion>
  6.  
  7. <groupId>com.xyg</groupId>
  8. <artifactId>spring-boot</artifactId>
  9. <version>1.0-SNAPSHOT</version>
  10.  
  11. <!-- 继承自Spring Boot -->
  12. <parent>
  13. <groupId>org.springframework.boot</groupId>
  14. <artifactId>spring-boot-starter-parent</artifactId>
  15. <version>2.0..RELEASE</version>
  16. </parent>
  17.  
  18. <!-- 添加Web应用程序的典型依赖项 -->
  19. <dependencies>
  20. <dependency>
  21. <groupId>org.springframework.boot</groupId>
  22. <artifactId>spring-boot-starter-web</artifactId>
  23. </dependency>
  24. </dependencies>
  25. <build>
  26. <plugins>
  27. <!-- 打包插件,打包成可执行jar包 -->
  28. <plugin>
  29. <groupId>org.springframework.boot</groupId>
  30. <artifactId>spring-boot-maven-plugin</artifactId>
  31. </plugin>
  32. </plugins>
  33. </build>
  34.  
  35. </project>

3. 创建主程序引导类

  1. package com.xyg;
  2.  
  3. import org.springframework.boot.SpringApplication;
  4. import org.springframework.boot.autoconfigure.SpringBootApplication;
  5.  
  6. /**
  7. * Author: Mr.Deng
  8. * Date: 2018/9/14
  9. * Desc: @SpringBootConfiguration来标注一个主程序类,说明这是一个springboot应用
  10. */
  11. @SpringBootApplication
  12. public class HelloWorldApplication {
  13.  
  14. public static void main(String[] args) {
  15. //springboot应用启动起来,run方法里第一个是应用主程序类名,第二个是应用参数
  16. SpringApplication.run(HelloWorldApplication.class,args);
  17. }
  18. }

编写Controller层Service

  1. package com.xyg.controller;
  2.  
  3. import org.springframework.stereotype.Controller;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.ResponseBody;
  6.  
  7. /**
  8. * Author: Mr.Deng
  9. * Date: 2018/9/14
  10. * Desc: 编写Controller层,发送hello请求
  11. */
  12.  
  13. @Controller
  14. public class HelloController {
  15.  
  16. @ResponseBody
  17. @RequestMapping("/hello")
  18. public String Hello(){
  19. return "Hello World!";
  20. }
  21. }

4. 启动程序测试

执行主程序里的main方法,控制台输出如下信息

  1. D:\Develop\Java\jdk1.\bin\java "-javaagent:D:\IDEA\IntelliJ IDEA 2018.1\lib\idea_rt.jar=62470:D:\IDEA\IntelliJ IDEA 2018.1\bin" -Dfile.encoding=UTF- -classpath D:\Develop\Java\jdk1.\jre\lib\charsets.jar;D:\Develop\Java\jdk1.\jre\lib\deploy.jar;D:\Develop\Java\jdk1.\jre\lib\ext\access-bridge-.jar;D:\Develop\Java\jdk1.\jre\lib\ext\cldrdata.jar;D:\Develop\Java\jdk1.\jre\lib\ext\dnsns.jar;D:\Develop\Java\jdk1.\jre\lib\ext\jaccess.jar;D:\Develop\Java\jdk1.\jre\lib\ext\jfxrt.jar;D:\Develop\Java\jdk1.\jre\lib\ext\localedata.jar;D:\Develop\Java\jdk1.\jre\lib\ext\nashorn.jar;D:\Develop\Java\jdk1.\jre\lib\ext\sunec.jar;D:\Develop\Java\jdk1.\jre\lib\ext\sunjce_provider.jar;D:\Develop\Java\jdk1.\jre\lib\ext\sunmscapi.jar;D:\Develop\Java\jdk1.\jre\lib\ext\sunpkcs11.jar;D:\Develop\Java\jdk1.\jre\lib\ext\zipfs.jar;D:\Develop\Java\jdk1.\jre\lib\javaws.jar;D:\Develop\Java\jdk1.\jre\lib\jce.jar;D:\Develop\Java\jdk1.\jre\lib\jfr.jar;D:\Develop\Java\jdk1.\jre\lib\jfxswt.jar;D:\Develop\Java\jdk1.\jre\lib\jsse.jar;D:\Develop\Java\jdk1.\jre\lib\management-agent.jar;D:\Develop\Java\jdk1.\jre\lib\plugin.jar;D:\Develop\Java\jdk1.\jre\lib\resources.jar;D:\Develop\Java\jdk1.\jre\lib\rt.jar;D:\IDEA\WorkSpace\spring-boot\target\classes;D:\Develop\maven\repository\org\springframework\boot\spring-boot-starter-web\2.0..RELEASE\spring-boot-starter-web-2.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\boot\spring-boot-starter\2.0..RELEASE\spring-boot-starter-2.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\boot\spring-boot\2.0..RELEASE\spring-boot-2.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\boot\spring-boot-autoconfigure\2.0..RELEASE\spring-boot-autoconfigure-2.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\boot\spring-boot-starter-logging\2.0..RELEASE\spring-boot-starter-logging-2.0..RELEASE.jar;D:\Develop\maven\repository\ch\qos\logback\logback-classic\1.2.\logback-classic-1.2..jar;D:\Develop\maven\repository\ch\qos\logback\logback-core\1.2.\logback-core-1.2..jar;D:\Develop\maven\repository\org\slf4j\slf4j-api\1.7.\slf4j-api-1.7..jar;D:\Develop\maven\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.\log4j-to-slf4j-2.10..jar;D:\Develop\maven\repository\org\apache\logging\log4j\log4j-api\2.10.\log4j-api-2.10..jar;D:\Develop\maven\repository\org\slf4j\jul-to-slf4j\1.7.\jul-to-slf4j-1.7..jar;D:\Develop\maven\repository\javax\annotation\javax.annotation-api\1.3.\javax.annotation-api-1.3..jar;D:\Develop\maven\repository\org\springframework\spring-core\5.0..RELEASE\spring-core-5.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\spring-jcl\5.0..RELEASE\spring-jcl-5.0..RELEASE.jar;D:\Develop\maven\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;D:\Develop\maven\repository\org\springframework\boot\spring-boot-starter-json\2.0..RELEASE\spring-boot-starter-json-2.0..RELEASE.jar;D:\Develop\maven\repository\com\fasterxml\jackson\core\jackson-databind\2.9.\jackson-databind-2.9..jar;D:\Develop\maven\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.\jackson-annotations-2.9..jar;D:\Develop\maven\repository\com\fasterxml\jackson\core\jackson-core\2.9.\jackson-core-2.9..jar;D:\Develop\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.\jackson-datatype-jdk8-2.9..jar;D:\Develop\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.\jackson-datatype-jsr310-2.9..jar;D:\Develop\maven\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.\jackson-module-parameter-names-2.9..jar;D:\Develop\maven\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0..RELEASE\spring-boot-starter-tomcat-2.0..RELEASE.jar;D:\Develop\maven\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.\tomcat-embed-core-8.5..jar;D:\Develop\maven\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.\tomcat-embed-el-8.5..jar;D:\Develop\maven\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.\tomcat-embed-websocket-8.5..jar;D:\Develop\maven\repository\org\hibernate\validator\hibernate-validator\6.0..Final\hibernate-validator-6.0..Final.jar;D:\Develop\maven\repository\javax\validation\validation-api\2.0..Final\validation-api-2.0..Final.jar;D:\Develop\maven\repository\org\jboss\logging\jboss-logging\3.3..Final\jboss-logging-3.3..Final.jar;D:\Develop\maven\repository\com\fasterxml\classmate\1.3.\classmate-1.3..jar;D:\Develop\maven\repository\org\springframework\spring-web\5.0..RELEASE\spring-web-5.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\spring-beans\5.0..RELEASE\spring-beans-5.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\spring-webmvc\5.0..RELEASE\spring-webmvc-5.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\spring-aop\5.0..RELEASE\spring-aop-5.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\spring-context\5.0..RELEASE\spring-context-5.0..RELEASE.jar;D:\Develop\maven\repository\org\springframework\spring-expression\5.0..RELEASE\spring-expression-5.0..RELEASE.jar com.xyg.HelloWorldApplication
  2.  
  3. . ____ _ __ _ _
  4. /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
  5. ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
  6. \\/ ___)| |_)| | | | | || (_| | ) ) ) )
  7. ' |____| .__|_| |_|_| |_\__, | / / / /
  8. =========|_|==============|___/=/_/_/_/
  9. :: Spring Boot :: (v2.0.5.RELEASE)
  10.  
  11. -- ::28.552 INFO --- [ main] com.xyg.HelloWorldApplication : Starting HelloWorldApplication on DTX with PID (D:\IDEA\WorkSpace\spring-boot\target\classes started by Administrator in D:\IDEA\WorkSpace\spring-boot)
  12. -- ::28.558 INFO --- [ main] com.xyg.HelloWorldApplication : No active profile set, falling back to default profiles: default
  13. -- ::28.953 INFO --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@55040f2f: startup date [Fri Sep :: CST ]; root of context hierarchy
  14. -- ::33.854 INFO --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): (http)
  15. -- ::34.001 INFO --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
  16. -- ::34.001 INFO --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.
  17. -- ::34.024 INFO --- [ost-startStop-] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\Develop\Java\jdk1.\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\Develop\maven\apache-maven-3.5./bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\NetSarang;D:\Develop\Java\jdk1.\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.\;D:\Develop\secureCRT\;D:\Develop\SVN\VisualSVN Server\bin;D:\Develop\SVN\TortoiseSVN\bin;D:\usr\hadoop-2.7.\bin;D:\usr\hadoop-2.7.\sbin;D:\Python tools\python2.7.9;D:\scalaTools\scala\bin;D:\usr\spark-1.6.-bin-hadoop2.\bin;D:\usr\spark-1.6.-bin-hadoop2.6sbin;D:\Python tools\python3.6.5;D:\Python tools\python2.7.9;D:\Python tools\python2.7.9\Scripts;D:\Python tools\python3.6.5\Scripts;D:\Develop\Git\cmd;D:\Develop\Git\TortoiseGit\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;;.]
  18. -- ::34.291 INFO --- [ost-startStop-] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
  19. -- ::34.292 INFO --- [ost-startStop-] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in ms
  20. -- ::34.470 INFO --- [ost-startStop-] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
  21. -- ::34.479 INFO --- [ost-startStop-] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
  22. 2018-09-14 15:37:34.480 INFO 8120 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
  23. 2018-09-14 15:37:34.480 INFO 8120 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
  24. 2018-09-14 15:37:34.480 INFO 8120 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
  25. 2018-09-14 15:37:34.840 INFO 8120 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  26. -- ::35.146 INFO --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@55040f2f: startup date [Fri Sep :: CST ]; root of context hierarchy
  27. -- ::35.373 INFO --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello]}" onto public java.lang.String com.xyg.controller.HelloController.Hello()
  28. -- ::35.382 INFO --- [ 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.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
  29. -- ::35.385 INFO --- [ 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.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
  30. -- ::35.451 INFO --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  31. 2018-09-14 15:37:35.451 INFO 8120 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  32. 2018-09-14 15:37:35.901 INFO 8120 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
  33. 2018-09-14 15:37:35.992 INFO 8120 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
  34. 2018-09-14 15:37:36.005 INFO 8120 --- [ main] com.xyg.HelloWorldApplication : Started HelloWorldApplication in 8.445 seconds (JVM running for 9.814)

通过查看日志信息发现tomcat:8080 启动,页面输入:  http://localhost:8080/hello ,

5.  部署服务

package打包jar在target目录,拷贝到左面,然后进入jar包所在目录,执行命令 java -jar  xxx.jar ,页面访问

6.  POM文件解析

1)spring boot 版本仲裁中心

  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>2.0..RELEASE</version>
  5. </parent>
  6. 它的父项目依赖
  7. <parent>
  8. <groupId>org.springframework.boot</groupId>
  9. <artifactId>spring-boot-dependencies</artifactId>
  10. <version>2.0..RELEASE</version>
  11. <relativePath>../../spring-boot-dependencies</relativePath>
  12. </parent>
  13. 他来真正管理spring boot应用里面所有的依赖版本,这里面定义了很多服务版本,当里面定义了服务版本时,我们就不需要再导入相关依赖,没有定义时,需手工导入依赖。

1)spring boot 场景启动器,帮我们导入web模块正常运行所依赖的组件。

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-web</artifactId>
  4. </dependency>
  5. 它的父模块来自
  6. <parent>
  7. <groupId>org.springframework.boot</groupId>
  8. <artifactId>spring-boot-starters</artifactId>
  9. <version>2.0..RELEASE</version>
  10. </parent>
  11. 它的父模块来自
  12. <parent>
  13. <groupId>org.springframework.boot</groupId>
  14. <artifactId>spring-boot-parent</artifactId>
  15. <version>2.0..RELEASE</version>
  16. <relativePath>../spring-boot-parent</relativePath>
  17. </parent>
  18. 它的父模块来自
  19. <parent>
  20. <groupId>org.springframework.boot</groupId>
  21. <artifactId>spring-boot-dependencies</artifactId>
  22. <version>2.0..RELEASE</version>
  23. <relativePath>../spring-boot-dependencies</relativePath>
  24. </parent>

spring boot 将所有的功能场景都抽取出来,做成一个个的starters(启动器),只需要在项目里引入相关的starter,相关场景的所有依赖都会导入进来。

7.@SpringBootApplication

Spring Boot应用标注在某个类上说明这个类是SpringBoot的主配置类,

  1. @Target({ElementType.TYPE})
  2. @Retention(RetentionPolicy.RUNTIME)
  3. @Documented
  4. @Inherited
  5. @SpringBootConfiguration
  6. @EnableAutoConfiguration
  7. @ComponentScan(
  8. excludeFilters = {@Filter(
  9. type = FilterType.CUSTOM,
  10. classes = {TypeExcludeFilter.class}
  11. ), @Filter(
  12. type = FilterType.CUSTOM,
  13. classes = {AutoConfigurationExcludeFilter.class}
  14. )}
  15. )
  16. public @interface SpringBootApplication {

@SpringBootConfiguration:Spring Boot的配置类; 标注在某个类上,表示这是一个Spring   Boot的配置类;

@Configuration:配置类上来标注这个注解;配置类 ----- 配置文件;配置类也是容器中的一个组件;@Component

@EnableAutoConfiguration:开启自动配置功能;以前我们需要配置的东西,SpringBoot帮我们自动配置;这个注解告诉SpringBoot开启自动配置功能;这样自动配置才能生效;

  1. @AutoConfigurationPackage
  2. @Import(EnableAutoConfigurationImportSelector.class)
  3. public @interface EnableAutoConfiguration {

@AutoConfigurationPackage:自动配置包@Import(AutoConfigurationPackages.Registrar.class):

Spring的底层注解@Import,给容器中导入一个组件;导入的组件由AutoConfigurationPackages.Registrar.class;

将主配置类(@SpringBootApplication标注的类)的所在包及下面所有子包里面的所有组件扫描到Spring容器;

@Import(EnableAutoConfigurationImportSelector.class); 给容器中导入组件?

EnableAutoConfigurationImportSelector:导入哪些组件的选择器;

将所有需要导入的组件以全类名的方式返回;这些组件就会被添加到容器中;

会给容器中导入非常多的自动配置类(xxxAutoConfiguration);就是给容器中导入这个场景需要的所有组件, 并配置好这些组件;

有了自动配置类,免去了我们手动编写配置注入功能组件等的工作;

SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.class,classLoader);

Spring Boot在启动的时候从类路径下的META-INF/spring.factories中获取EnableAutoConfiguration指定的值,将这些值作为自动配置类导入到容器中,自动配置类就生效,帮我们进行自动配置工作;以前我们需要自己配置的东      西,自动配置类都帮我们;

J2EE的整体整合解决方案和自动配置都在spring-boot-autoconfigure-2.0.5.RELEASE.jar;

8.springboot向导创建

(前提条件-联网条件下)快速创建一个spring boot项目,new project

点击flish完成项目创建,把下面不用的几项删除掉

然后编写controller层代码测试(略)

三.配置文件

1.application.properties

resource里面有三个文件,application.properties  或者  application.yml ,两者的书写格式不一样,为SpringBoot的全局配置文件,配置文件名是固定的,

配置文件的作用:修改SpringBoot自动配置的默认值;SpringBoot在底层都给我们自动配置好;

2.static

静态资源都放在这个包下

3.templates

模板

四.日志框架

SpringBoot默认选用 SLF4jlogback

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring‐boot‐starter‐logging</artifactId>
  4. </dependency>

给类路径下放上每个日志框架自己的配置文件即可;SpringBoot就不使用他默认配置的了

Logging System Customization

Logback

logback-spring.xmllogback-spring.groovylogback.xml, or logback.groovy

Log4j2

log4j2-spring.xml or log4j2.xml

JDK (Java Util Logging)

logging.properties

logback.xml:直接就被日志框架识别了;logback-spring.xml:日志框架就不直接加载日志的配置项,由SpringBoot解析日志配置,可以使用SpringBoot的高级Profile功能。

Spring Boot 入门案例与配置说明的更多相关文章

  1. Springboot 系列(一)Spring Boot 入门篇

    注意:本 Spring Boot 系列文章基于 Spring Boot 版本 v2.1.1.RELEASE 进行学习分析,版本不同可能会有细微差别. 前言 由于 J2EE 的开发变得笨重,繁多的配置, ...

  2. spring boot入门小案例

    spring boot 入门小案例搭建 (1) 在Eclipse中新建一个maven project项目,目录结构如下所示: cn.com.rxyb中存放spring boot的启动类,applica ...

  3. Spring Boot 入门之 Web 篇(二)

    原文地址:Spring Boot 入门之 Web 篇(二) 博客地址:http://www.extlight.com 一.前言 上一篇<Spring Boot 入门之基础篇(一)>介绍了 ...

  4. Spring Boot 入门之基础篇(一)

    原文地址:Spring Boot 入门之基础篇(一) 博客地址:http://www.extlight.com 一.前言 Spring Boot 是由 Pivotal 团队提供的全新框架,其设计目的是 ...

  5. Spring Boot 入门(十一):集成 WebSocket, 实时显示系统日志

    以前面的博客为基础,最近一篇为Spring Boot 入门(十):集成Redis哨兵模式,实现Mybatis二级缓存.本篇博客主要介绍了Spring Boot集成 Web Socket进行日志的推送, ...

  6. 161103、Spring Boot 入门

    Spring Boot 入门 spring Boot是Spring社区较新的一个项目.该项目的目的是帮助开发者更容易的创建基于Spring的应用程序和服务,让更多人的人更快的对Spring进行入门体验 ...

  7. spring boot 入门操作(二)

    spring boot入门操作 使用FastJson解析json数据 pom dependencies里添加fastjson依赖 <dependency> <groupId>c ...

  8. spring boot 入门操作(三)

    spring boot入门操作 devtools热部署 pom dependencies里添加依赖 <dependency> <groupId>org.springframew ...

  9. Spring Boot入门教程1、使用Spring Boot构建第一个Web应用程序

    一.前言 什么是Spring Boot?Spring Boot就是一个让你使用Spring构建应用时减少配置的一个框架.约定优于配置,一定程度上提高了开发效率.https://zhuanlan.zhi ...

随机推荐

  1. c# 移除文本文件里的某一行

    参考自:http://zhidao.baidu.com/question/87467507.html //定义一个变量用来存读到的东西 string text = ""; //用一 ...

  2. 【枚举Day1】20170529-2枚举算法专题练习 题解

    题目: http://www.cnblogs.com/ljc20020730/p/6918328.html 评测器:cena 评测记录: 1.OneMoreRectangle 一个矩形 ●如果任意枚举 ...

  3. 一步步创建第一个Docker App —— 4. 部署应用

    原文:https://docs.docker.com/engine/getstarted-voting-app/deploy-app/ 在这一步中,将会使用第一步提到的 docker-stack.ym ...

  4. bzoj3920: Yuuna的礼物(莫队+分块套分块)

    思路挺简单的,但是总感觉好难写...码力还是差劲,最后写出来也挺丑的 这题显然是个莫队题,考虑怎么转移和询问... 根据莫队修改多查询少的特点,一般用修改快查询慢的分块来维护.查第$k_1$小的出现次 ...

  5. Zabbix应用六:Zabbix监控Redis

    利用Zabbix监控Redis Zabbix监控redis就比较简单了,因为zabbix官方提供了监控redis的模版和脚本,而且脚本有nodejs和python两种,下载地址:https://git ...

  6. python创建与遍历List二维列表

    python创建与遍历List二维列表 觉得有用的话,欢迎一起讨论相互学习~Follow Me python 创建List二维列表 lists = [[] for i in range(3)] # 创 ...

  7. zsh与oh-my-zsh是什么

    zsh是bash的增强版,其实zsh和bash是两个不同的概念.zsh更加强大. 通常zsh配置起来非常麻烦,且相当的复杂,所以oh-my-zsh是为了简化zsh的配置而开发的,因此oh-my-zsh ...

  8. [软件]在浏览器里添加MarkDown Here(插件)

    1. 先来说说这个插件的作用是什么: 用于在网页一些编辑文本的地方, 使用MacDown编辑文本 支持大部分浏览器,  https://github.com/adam-p/markdown-here ...

  9. Java入门系列(七)Java 集合框架(JCF, Java Collections Framework)

    Java 集合概述 List.Set.Map可以看做集合的三大类 java集合就像一个容器,可以将多个对象的引用丢进该容器中. Collection和Map是java集合的根接口. List List ...

  10. CS229 笔记02

    CS229 笔记02 公式推导 $ {\text {For simplicity, Let }} A, B, C \in {\Bbb {R}}^{n \times n}. $ ​ $ {\bf {\t ...