【Spring Boot && Spring Cloud系列】Spring Boot的启动器Starter
Spring Boot的内置Servlet Container:
| Name | Servlet Version | Java Version |
| Tomcat8 | 3.1 | Java 7+ |
| Tomcat7 | 3.0 | Java 6+ |
| Jetty 9.3 | 3.1 | Java 8+ |
| Jetty9.2 | 3.1 | Java7+ |
| Jetty8 | 3.0 | Java 6+ |
| Undertow1.3 | 3.1 | Java 7+ |
Depency Management:
每个版本的Spring Boot都提供了一个依赖列表,这个列表包含了你可能通过Spring Boot用到的所有的Spring模块以及第三方库,该列表可以以BOM的形式支持Maven
Bom和Starter的区别
1、集成spring-boot-starter-parent
spring-boot-starter-parent project默认是Java 1.6.Resource filtering.exec plugin、surefire、Git Commit ID、shade.
Resource filtering for application.properties 和 application.yml,以及,profile-specific file,如application-foo.properties 或 application-foo.yml。
如果不想使用Spring Boot中的默认版本,可以在<properties>覆盖相应的版本,如,想使用不同版本的Spring Data,具体如下:
<properties>
<spring-data-releasetrain.version>Fowler-SR2</spring-data-releasetrain.version>
<!-- 使用 java 1.8 -->
<java.version>1.8</java.version>
</properties>
2、不继承spring-boot-starter-parent,这个时候可以使用depency management但是不能使用plugin management
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.4..RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
注意:scope是import,而且这种情况下,不允许在<properties>覆盖相应的版本。如果要使用其他版本,需要在上面的前面添加一个完整的depency:
<dependencyManagement>
<dependencies>
<!-- Override Spring Data release train provided by Spring Boot -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>Fowler-SR2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.4..RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
除此之外,Spring Boot还提供了一个Maven plugin:spring-boot-maven-plugin用于将项目打包成fat jar:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
自动配置:
import org.springframework.boot.autoconfigure.*;
import org.springframework.boot.autoconfigure.jdbc.*;
import org.springframework.context.annotation.*;
@Configuration
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class MyConfiguration {
}
如果class不在classpath中,可以使用excludeName,然后使用全路径即可。
@Configuration,@EnableAutoConfiguration and --@ComponentScan。 使用Spring Boot在pom.xml中的配置解释:
1、spring-boot-starter
Spring Boot的核心启动器,包含了自动配置、日志和YAML
2、spring-boot-starter-actuator
帮助监控和管理应用
3、spring-boot-starter-amqp
通过spring-rabbit来支持AMQP协议(Advanced Message Queuing Protocol)
4、spring-boot-starter-aop
支持面向方面的编程即AOP。包括spring-aop和AspectJ
5、spring-boot-starter-artemis
通过Apache Artemis支持JMS的API(Java Message Service API)
6、spring-boot-starter-batch
支持Spring Batch,包括HSQLDB数据库
7、spring-boot-starter-cache
支持Spring的Cache抽象
8、spring-boot-starter-cloud-connectors
支持Spring Cloud Connectors,简化了在像Cloud Foundry或Heroku这样的云平台上的连接服务
9、spring-boot-starter-data-elasticsearch
支持ElasticSearch搜索和分析引擎,包括spring-data-elasticsearch
10、spring-boot-starter-data-genfire
支持GemFire分布式数据存储,包括spring-data-gemfire
11、spring-boot-starter-data-jpa
支持JPA(Java Persistence API),包括spring-data-jpa spring-orm Hibernate
12、spring-boot-starter-data-mongodb
支持MongoDB数据库,包括spring-data-mpngodb
13、spring-boot-starter-data-rest
通过spring-data-rest-webmvc,支持通过RESR暴露Spring Data数据仓库
14、spring-boot-starter-data-solr
支持Apache Solr搜索平台,包括spring-data-solr。
15、spring-boot-starter-freemarker
支持FreeMarker模板引擎。
16、spring-boot-starter-groovy-templates
支持Groovy模板引擎。
17、spring-boot-starter-hateoas
通过spring-hateoas支持基于HATEOAS的RESTful Web服务。
18、spring-boot-starter-hornetq
通过HornetQ支持JMS。
19、spring-boot-starter-integration
支持通用的spring-integration模块。
20、spring-boot-starter-jdbc
支持JDBC数据库。
21、spring-boot-starter-jersey
支持Jersey RESTful Web服务框架。
22、spring-boot-starter-jta-atomikos
通过Atomikos支持JTA分布式事务处理。
23、spring-boot-starter-jta-bitronix
通过Bitronix支持JTA分布式事务处理。
24、spring-boot-starter-mail
支持javax.mail模块。
25、spring-boot-starter-mobile
支持spring-mobile。
26、spring-boot-starter-mustache
支持Mustache模板引擎。
27、spring-boot-starter-redis
支持Redis键值存储数据库,包括spring-redis。
28、spring-boot-starter-security
支持spring-security。
29、spring-boot-starter-social-facebook
支持spring-social-facebook
30、spring-boot-starter-social-linkedin
支持pring-social-linkedin
31、spring-boot-starter-social-twitter
支持pring-social-twitter
32、spring-boot-starter-test
支持常规的测试依赖,包括JUnit、Hamcrest、Mockito以及spring-test模块。
33、spring-boot-starter-thymeleaf
支持Thymeleaf模板引擎,包括与Spring的集成。
34、spring-boot-starter-velocity
支持Velocity模板引擎。
35、spring-boot-starter-web
S支持全栈式Web开发,包括Tomcat和spring-webmvc。
36、spring-boot-starter-websocket
支持WebSocket开发。
37、spring-boot-starter-ws
支持Spring Web Services。
38、Spring Boot应用启动器面向生产环境的还有2种,具体如下:
1)spring-boot-starter-actuator
增加了面向产品上线相关的功能,比如测量和监控。
2)spring-boot-starter-remote-shell
增加了远程ssh shell的支持。
39、Spring Boot应用启动器还有一些替换技术的启动器,具体如下:
1)spring-boot-starter-jetty
引入了Jetty HTTP引擎(用于替换Tomcat)。
2)spring-boot-starter-log4j
支持Log4J日志框架。
3)spring-boot-starter-logging
引入了Spring Boot默认的日志框架Logback。
4)spring-boot-starter-tomcat
引入了Spring Boot默认的HTTP引擎Tomcat。
5)spring-boot-starter-undertow
引入了Undertow HTTP引擎(用于替换Tomcat)。
【Spring Boot && Spring Cloud系列】Spring Boot的启动器Starter的更多相关文章
- spring boot 2.x 系列 —— spring boot 实现分布式 session
文章目录 一.项目结构 二.分布式session的配置 2.1 引入依赖 2.2 Redis配置 2.3 启动类上添加@EnableRedisHttpSession 注解开启 spring-sessi ...
- spring boot 2.x 系列 —— spring boot 整合 redis
文章目录 一.说明 1.1 项目结构 1.2 项目主要依赖 二.整合 Redis 2.1 在application.yml 中配置redis数据源 2.2 封装redis基本操作 2.3 redisT ...
- spring boot 2.x 系列 —— spring boot 整合 dubbo
文章目录 一. 项目结构说明 二.关键依赖 三.公共模块(boot-dubbo-common) 四. 服务提供者(boot-dubbo-provider) 4.1 提供方配置 4.2 使用注解@Ser ...
- spring boot 2.x 系列 —— spring boot 整合 druid+mybatis
源码Gitub地址:https://github.com/heibaiying/spring-samples-for-all 一.说明 1.1 项目结构 项目查询用的表对应的建表语句放置在resour ...
- spring boot 2.x 系列 —— spring boot 整合 servlet 3.0
文章目录 一.说明 1.1 项目结构说明 1.2 项目依赖 二.采用spring 注册方式整合 servlet 2.1 新建过滤器.监听器和servlet 2.2 注册过滤器.监听器和servlet ...
- spring boot 2.x 系列 —— spring boot 整合 RabbitMQ
文章目录 一. 项目结构说明 二.关键依赖 三.公共模块(rabbitmq-common) 四.服务消费者(rabbitmq-consumer) 4.1 消息消费者配置 4.2 使用注解@Rabbit ...
- spring boot 2.x 系列 —— spring boot 整合 kafka
文章目录 一.kafka的相关概念: 1.主题和分区 2.分区复制 3. 生产者 4. 消费者 5.broker和集群 二.项目说明 1.1 项目结构说明 1.2 主要依赖 二. 整合 kafka 2 ...
- 【Spring Boot&&Spring Cloud系列】Spring Boot配置文件
很多的参数可以配置在application.properties或application.yml文件中 一.BANNER banner.charset=UTF-8 # Banner file enco ...
- 【Spring Boot&&Spring Cloud系列】提高数据库访问性能
前言 使用关系型数据库的应用系统的性能瓶颈最终还是数据库.随着业务的迅速增长,数据量会不断增大,会逐渐暴露关系型数据库的弱点,性能会大幅度的降低 项目地址:https://github.com/And ...
随机推荐
- [深入理解Android卷一全文-第三章]深入理解init
因为<深入理解Android 卷一>和<深入理解Android卷二>不再出版,而知识的传播不应该因为纸质媒介的问题而中断,所以我将在CSDN博客中全文转发这两本书的全部内容. ...
- 【阿里云】WindowsServer2012 搭建FTP站点 图文记录
配置说明: 服务商:阿里云 系统: WindowsServer2012 一:配置FTP服务器 1.进入操作系统,直接从启动栏打开服务器管理器,选择添加功能和角色 2.选择服务器 3.勾选FTP服务器选 ...
- (个人)CentOS的JDK安装
一. 卸载JDK 1. 通过如下命令查看当前JDK的相关内容 rpm -qa | grep java 2. 如果出现如下内容 java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el ...
- Css 去除浮动
清除浮动的方法 清除浮动方法大致有两类,一类是clear:both | left | right ,另一类则是创建BFC,细分又可以分为多种. 通过在浮动元素末尾添加一个空的标签例如并设置样式为cle ...
- 复习js
js写在页面最后如果放在前面,需要加window.onload=function(){)常见的两种输出方式 在网页中弹出显示框,显示信息 alert() 在控制台输出消息,一般用来调试程序consol ...
- javascript的闭包计数器实现,python实现各种方法来实现计数器
菜鸟教程的javascript闭包章节中,演示了js计数器的实现. 教程地址 http://www.runoob.com/js/js-function-closures.html 代码1 var ...
- MTK 预置apk
一.如何将带源码的APK预置进系统? 1) 在 packages/apps 下面以需要预置的 APK的 名字创建一个新文件夹,以预置一个名为Test的APK 为例 2) 将 Test ...
- Java使用for循环输出杨辉三角
杨辉三角形由数字排列,可以把它看做一个数字表,其基本特性是两侧数值均为1,其他位置的数值是其正上方的数字与左上角数值之和.编写程序,使用for循环输出包括10行在内的杨辉三角形. 思路是创建一个整型二 ...
- PMP模拟考试-2
1. Increasing resources on the critical path activities may not always shorten the length of the pro ...
- swift--歌曲播放示例
使用MPMoviePlayerController我们可以是进行音乐播放,如下图: 接口的话,我是自己在本地上搭建了个服务器,自己请求自己