父工程
这里的 Pom 文件使用的是前一篇入门程序搭建中使用的 Pom 文件。
首先,我们引入了一个父工程:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/>
</parent>
而这个父工程本身还有一个父工程:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath>../../spring-boot-dependencies</relativePath>
</parent>
这个父工程管理了 SpringBoot 应用中的所有依赖版本,它可以称为 SpringBoot 的版本管理中心,所以以后我们导入它管理的依赖是不需要声明版本的。
场景启动器
我们还引入如下依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
该依赖帮我们导入了 Web 模块正常运行所有依赖的组件。
在使用 SpringBoot 的过程中,还有很多 artifactId
以 spring-boot-starter
开头的依赖,这种依赖就被成为场景启动器。
SpringBoot 将所有功能场景都抽取出来,做成一个个 starter (场景启动器),只需要在项目中引入这些 starter 相关场景的所有依赖都会导入进来,要使用什么功能就导入什么场景启动器。
下面是 SpringBoot 提供的一些场景启动器:
Name | Description | Pom |
---|---|---|
Core starter, including auto-configuration support, logging and YAML | ||
Starter for JMS messaging using Apache ActiveMQ | ||
Starter for using Spring AMQP and Rabbit MQ | ||
Starter for aspect-oriented programming with Spring AOP and AspectJ | ||
Starter for JMS messaging using Apache Artemis | ||
Starter for using Spring Batch | ||
Starter for using Spring Framework’s caching support | ||
Starter for using Spring Cloud Connectors which simplifies connecting to services in cloud platforms like Cloud Foundry and Heroku | ||
Starter for using Cassandra distributed database and Spring Data Cassandra | ||
Starter for using Cassandra distributed database and Spring Data Cassandra Reactive | ||
Starter for using Couchbase document-oriented database and Spring Data Couchbase | ||
Starter for using Couchbase document-oriented database and Spring Data Couchbase Reactive | ||
Starter for using Elasticsearch search and analytics engine and Spring Data Elasticsearch | ||
Starter for using Spring Data JDBC | ||
Starter for using Spring Data JPA with Hibernate | ||
Starter for using Spring Data LDAP | ||
Starter for using MongoDB document-oriented database and Spring Data MongoDB | ||
Starter for using MongoDB document-oriented database and Spring Data MongoDB Reactive | ||
Starter for using Neo4j graph database and Spring Data Neo4j | ||
Starter for using Redis key-value data store with Spring Data Redis and the Lettuce client | ||
Starter for using Redis key-value data store with Spring Data Redis reactive and the Lettuce client | ||
Starter for exposing Spring Data repositories over REST using Spring Data REST | ||
Starter for using the Apache Solr search platform with Spring Data Solr | ||
Starter for building MVC web applications using FreeMarker views | ||
Starter for building MVC web applications using Groovy Templates views | ||
Starter for building hypermedia-based RESTful web application with Spring MVC and Spring HATEOAS | ||
Starter for using Spring Integration | ||
Starter for using JDBC with the HikariCP connection pool | ||
Starter for building RESTful web applications using JAX-RS and Jersey. An alternative to | ||
Starter for using jOOQ to access SQL databases. An alternative to | ||
Starter for reading and writing json | ||
Starter for JTA transactions using Atomikos | ||
Starter for JTA transactions using Bitronix | ||
Starter for using Java Mail and Spring Framework’s email sending support | ||
Starter for building web applications using Mustache views | ||
Starter for using Spring Security’s OAuth2/OpenID Connect client features | ||
Starter for using Spring Security’s OAuth2 resource server features | ||
Starter for using the Quartz scheduler | ||
Starter for using Spring Security | ||
Starter for testing Spring Boot applications with libraries including JUnit, Hamcrest and Mockito | ||
Starter for building MVC web applications using Thymeleaf views | ||
Starter for using Java Bean Validation with Hibernate Validator | ||
Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container | ||
Starter for using Spring Web Services | ||
Starter for building WebFlux applications using Spring Framework’s Reactive Web support | ||
Starter for building WebSocket applications using Spring Framework’s WebSocket support |
评论区