Spring Boot实践(一) 理解Spring Boot中的pom配置

spring-boot-starter-parent

    
        org.springframework.boot
        spring-boot-starter-parent
        2.0.4.RELEASE
    

该依赖可以从Starter Parent继承以获得一些默认配置,供以下功能:

  • Java 1.8作为默认编译器级别
  • UTF-8编码
  • 从spring-boot-dependencies pom继承一些公共依赖的版本号,从而在使用这些依赖时不用配置
  • 自动resounce filter
  • 自动plugin配置(exec, git)
  • 自动读取配置文件application.properties和application.yml,包括application-dev.properties和application-dev.yml

如果公司不需要集成spring-boot-dependencies pom中的配置,可以通过设置scope来管理依赖

 
         
         
             
             org.springframework.boot  
             spring-boot-dependencies  
             2.0 .4.RELEASE  
             pom  
             import  
         
     

也可以自定义单~个依赖来覆盖

 
     
        <! - 覆盖Spring Boot提供的Spring Data发布系列 - > 
         
             org.springframework.data  
             spring-data-releasetrain  
            < version> Fowler-SR2  
             pom  
             import  
         
         
             org.springframework.boot  
             spring-boot -dependencies  
            2.0.4.RELEASE  
             pom 
             import  
         
     

Maven插件
可以将项目打包成可执行的jar文件

 
     
         
             org.springframework.boot  
             spring-boot-maven-plugin  
         
     

Starter
Starter表示一组依赖的集合,Spring Boot提供了Starter这样的一站式服务来对依赖进行管理,节省了复制粘贴依赖的时间。官方的Starter命名模式为spring-boot-starter-*,org.springframework.boot提供的Starter如下:

Name Description Pom
spring-boot-starter Core starter, including auto-configuration support, logging and YAML Pom
spring-boot-starter-activemq Starter for JMS messaging using Apache ActiveMQ Pom
spring-boot-starter-amqp Starter for using Spring AMQP and Rabbit MQ Pom
spring-boot-starter-aop Starter for aspect-oriented programming with Spring AOP and AspectJ Pom
spring-boot-starter-artemis Starter for JMS messaging using Apache Artemis Pom
spring-boot-starter-batch Starter for using Spring Batch Pom
spring-boot-starter-cache Starter for using Spring Framework’s caching support Pom
spring-boot-starter-cloud-connectors Starter for using Spring Cloud Connectors which simplifies connecting to services in cloud platforms like Cloud Foundry and Heroku Pom
spring-boot-starter-data-cassandra Starter for using Cassandra distributed database and Spring Data Cassandra Pom
spring-boot-starter-data-cassandra-reactive Starter for using Cassandra distributed database and Spring Data Cassandra Reactive Pom
spring-boot-starter-data-couchbase Starter for using Couchbase document-oriented database and Spring Data Couchbase Pom
spring-boot-starter-data-couchbase-reactive Starter for using Couchbase document-oriented database and Spring Data Couchbase Reactive Pom
spring-boot-starter-data-elasticsearch Starter for using Elasticsearch search and analytics engine and Spring Data Elasticsearch Pom
spring-boot-starter-data-jpa Starter for using Spring Data JPA with Hibernate Pom
spring-boot-starter-data-ldap Starter for using Spring Data LDAP Pom
spring-boot-starter-data-mongodb Starter for using MongoDB document-oriented database and Spring Data MongoDB Pom
spring-boot-starter-data-mongodb-reactive Starter for using MongoDB document-oriented database and Spring Data MongoDB Reactive Pom
spring-boot-starter-data-neo4j Starter for using Neo4j graph database and Spring Data Neo4j Pom
spring-boot-starter-data-redis Starter for using Redis key-value data store with Spring Data Redis and the Lettuce client Pom
spring-boot-starter-data-redis-reactive Starter for using Redis key-value data store with Spring Data Redis reactive and the Lettuce client Pom
spring-boot-starter-data-rest Starter for exposing Spring Data repositories over REST using Spring Data REST Pom
spring-boot-starter-data-solr Starter for using the Apache Solr search platform with Spring Data Solr Pom
spring-boot-starter-freemarker Starter for building MVC web applications using FreeMarker views Pom
spring-boot-starter-groovy-templates Starter for building MVC web applications using Groovy Templates views Pom
spring-boot-starter-hateoas Starter for building hypermedia-based RESTful web application with Spring MVC and Spring HATEOAS Pom
spring-boot-starter-integration Starter for using Spring Integration Pom
spring-boot-starter-jdbc Starter for using JDBC with the HikariCP connection pool Pom
spring-boot-starter-jersey Starter for building RESTful web applications using JAX-RS and Jersey. An alternative to spring-boot-starter-web Pom
spring-boot-starter-jooq Starter for using jOOQ to access SQL databases. An alternative to spring-boot-starter-data-jpa or spring-boot-starter-jdbc Pom
spring-boot-starter-json Starter for reading and writing json Pom
spring-boot-starter-jta-atomikos Starter for JTA transactions using Atomikos Pom
spring-boot-starter-jta-bitronix Starter for JTA transactions using Bitronix Pom
spring-boot-starter-jta-narayana Starter for JTA transactions using Narayana Pom
spring-boot-starter-mail Starter for using Java Mail and Spring Framework’s email sending support Pom
spring-boot-starter-mustache Starter for building web applications using Mustache views Pom
spring-boot-starter-quartz Starter for using the Quartz scheduler Pom
spring-boot-starter-security Starter for using Spring Security Pom
spring-boot-starter-test Starter for testing Spring Boot applications with libraries including JUnit, Hamcrest and Mockito Pom
spring-boot-starter-thymeleaf Starter for building MVC web applications using Thymeleaf views Pom
spring-boot-starter-validation Starter for using Java Bean Validation with Hibernate Validator Pom
spring-boot-starter-web Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container Pom
spring-boot-starter-web-services Starter for using Spring Web Services Pom
spring-boot-starter-webflux Starter for building WebFlux applications using Spring Framework’s Reactive Web support Pom
spring-boot-starter-websocket Starter for building WebSocket applications using Spring Framework’s WebSocket support Pom

actuator提供了Spring Boot的监控和管理功能

Name Description Pom
spring-boot-starter-actuator Starter for using Spring Boot’s Actuator which provides production ready features to help you monitor and manage your application Pom

除此之外,Spring Boot还提供了一些组件加入或者排除

Name Description Pom
spring-boot-starter-jetty Starter for using Jetty as the embedded servlet container. An alternative to spring-boot-starter-tomcat Pom
spring-boot-starter-log4j2 Starter for using Log4j2 for logging. An alternative to spring-boot-starter-logging Pom
spring-boot-starter-logging Starter for logging using Logback. Default logging starter Pom
spring-boot-starter-reactor-netty Starter for using Reactor Netty as the embedded reactive HTTP server. Pom
spring-boot-starter-tomcat Starter for using Tomcat as the embedded servlet container. Default servlet container starter used by spring-boot-starter-web Pom
spring-boot-starter-undertow Starter for using Undertow as the embedded servlet container. An alternative to spring-boot-starter-tomcat Pom

你可能感兴趣的:(Spring Boot实践(一) 理解Spring Boot中的pom配置)