Mongoosej.Blog.Software.Programming.Java.Framework.Spring.SpringBoot.API


spring-boot-xxx.jar

  1. <groupId>org.springframework.boot</groupId>
  2. <artifactId>spring-boot</artifactId>

SpringApplication

org.springframework.boot.SpringApplication

getSpringFactoriesInstances

SpringBoot实现自动配置的核心方法之一。

SpringApplicationBuilder

org.springframework.boot.builder.SpringApplicationBuilder

spring-boot-autoconfigure-xxx.jar

  1. <groupId>org.springframework.boot</groupId>
  2. <artifactId>spring-boot-autoconfigure</artifactId>

META-INF

spring.factories

spring-boot-autoconfigure-xxx.jar/META-INF/spring.factories
该文件是一个属性文件,是springboot自动配置的关键配置,springboot会从该文件中读取key=org.springframework.boot.autoconfigure.EnableAutoConfiguration的属性所对应的value值,value值是一组配置类的全限定名,它基本上包含了所有主流技术的配置类,springboot启动时将会去加载这些配置类,完成自动配置。

  1. # Initializers
  2. org.springframework.context.ApplicationContextInitializer=\
  3. org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer,\
  4. org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener
  5. # Application Listeners
  6. org.springframework.context.ApplicationListener=\
  7. org.springframework.boot.autoconfigure.BackgroundPreinitializer
  8. # Environment Post Processors
  9. org.springframework.boot.env.EnvironmentPostProcessor=\
  10. org.springframework.boot.autoconfigure.integration.IntegrationPropertiesEnvironmentPostProcessor
  11. # Auto Configuration Import Listeners
  12. org.springframework.boot.autoconfigure.AutoConfigurationImportListener=\
  13. org.springframework.boot.autoconfigure.condition.ConditionEvaluationReportAutoConfigurationImportListener
  14. # Auto Configuration Import Filters
  15. org.springframework.boot.autoconfigure.AutoConfigurationImportFilter=\
  16. org.springframework.boot.autoconfigure.condition.OnBeanCondition,\
  17. org.springframework.boot.autoconfigure.condition.OnClassCondition,\
  18. org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition
  19. # Auto Configure
  20. org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
  21. org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration,\
  22. org.springframework.boot.autoconfigure.aop.AopAutoConfiguration,\
  23. org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration,\
  24. org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\
  25. org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\
  26. org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration,\
  27. org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,\
  28. org.springframework.boot.autoconfigure.context.LifecycleAutoConfiguration,\
  29. org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration,\
  30. org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration,\
  31. org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration,\
  32. org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration,\
  33. org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration,\
  34. org.springframework.boot.autoconfigure.data.cassandra.CassandraReactiveDataAutoConfiguration,\
  35. org.springframework.boot.autoconfigure.data.cassandra.CassandraReactiveRepositoriesAutoConfiguration,\
  36. org.springframework.boot.autoconfigure.data.cassandra.CassandraRepositoriesAutoConfiguration,\
  37. org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration,\
  38. org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveDataAutoConfiguration,\
  39. org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveRepositoriesAutoConfiguration,\
  40. org.springframework.boot.autoconfigure.data.couchbase.CouchbaseRepositoriesAutoConfiguration,\
  41. org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration,\
  42. org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration,\
  43. org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRepositoriesAutoConfiguration,\
  44. org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRestClientAutoConfiguration,\
  45. org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration,\
  46. org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration,\
  47. org.springframework.boot.autoconfigure.data.ldap.LdapRepositoriesAutoConfiguration,\
  48. org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration,\
  49. org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration,\
  50. org.springframework.boot.autoconfigure.data.mongo.MongoReactiveRepositoriesAutoConfiguration,\
  51. org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration,\
  52. org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration,\
  53. org.springframework.boot.autoconfigure.data.neo4j.Neo4jReactiveDataAutoConfiguration,\
  54. org.springframework.boot.autoconfigure.data.neo4j.Neo4jReactiveRepositoriesAutoConfiguration,\
  55. org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoConfiguration,\
  56. org.springframework.boot.autoconfigure.data.r2dbc.R2dbcDataAutoConfiguration,\
  57. org.springframework.boot.autoconfigure.data.r2dbc.R2dbcRepositoriesAutoConfiguration,\
  58. org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,\
  59. org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration,\
  60. org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration,\
  61. org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration,\
  62. org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration,\
  63. org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration,\
  64. org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration,\
  65. org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration,\
  66. org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration,\
  67. org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration,\
  68. org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration,\
  69. org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration,\
  70. org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration,\
  71. org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration,\
  72. org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration,\
  73. org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration,\
  74. org.springframework.boot.autoconfigure.influx.InfluxDbAutoConfiguration,\
  75. org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration,\
  76. org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration,\
  77. org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration,\
  78. org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\
  79. org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration,\
  80. org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration,\
  81. org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration,\
  82. org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\
  83. org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration,\
  84. org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,\
  85. org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration,\
  86. org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration,\
  87. org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration,\
  88. org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration,\
  89. org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration,\
  90. org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration,\
  91. org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration,\
  92. org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration,\
  93. org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration,\
  94. org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration,\
  95. org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration,\
  96. org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration,\
  97. org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration,\
  98. org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration,\
  99. org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\
  100. org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration,\
  101. org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration,\
  102. org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration,\
  103. org.springframework.boot.autoconfigure.netty.NettyAutoConfiguration,\
  104. org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\
  105. org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration,\
  106. org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration,\
  107. org.springframework.boot.autoconfigure.r2dbc.R2dbcTransactionManagerAutoConfiguration,\
  108. org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration,\
  109. org.springframework.boot.autoconfigure.rsocket.RSocketRequesterAutoConfiguration,\
  110. org.springframework.boot.autoconfigure.rsocket.RSocketServerAutoConfiguration,\
  111. org.springframework.boot.autoconfigure.rsocket.RSocketStrategiesAutoConfiguration,\
  112. org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration,\
  113. org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration,\
  114. org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration,\
  115. org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration,\
  116. org.springframework.boot.autoconfigure.security.reactive.ReactiveUserDetailsServiceAutoConfiguration,\
  117. org.springframework.boot.autoconfigure.security.rsocket.RSocketSecurityAutoConfiguration,\
  118. org.springframework.boot.autoconfigure.security.saml2.Saml2RelyingPartyAutoConfiguration,\
  119. org.springframework.boot.autoconfigure.sendgrid.SendGridAutoConfiguration,\
  120. org.springframework.boot.autoconfigure.session.SessionAutoConfiguration,\
  121. org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration,\
  122. org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration,\
  123. org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration,\
  124. org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration,\
  125. org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration,\
  126. org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfiguration,\
  127. org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration,\
  128. org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration,\
  129. org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\
  130. org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration,\
  131. org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration,\
  132. org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\
  133. org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration,\
  134. org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration,\
  135. org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration,\
  136. org.springframework.boot.autoconfigure.web.reactive.ReactiveMultipartAutoConfiguration,\
  137. org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryAutoConfiguration,\
  138. org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration,\
  139. org.springframework.boot.autoconfigure.web.reactive.WebSessionIdResolverAutoConfiguration,\
  140. org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration,\
  141. org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorAutoConfiguration,\
  142. org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration,\
  143. org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration,\
  144. org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration,\
  145. org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration,\
  146. org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration,\
  147. org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration,\
  148. org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration,\
  149. org.springframework.boot.autoconfigure.websocket.reactive.WebSocketReactiveAutoConfiguration,\
  150. org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration,\
  151. org.springframework.boot.autoconfigure.websocket.servlet.WebSocketMessagingAutoConfiguration,\
  152. org.springframework.boot.autoconfigure.webservices.WebServicesAutoConfiguration,\
  153. org.springframework.boot.autoconfigure.webservices.client.WebServiceTemplateAutoConfiguration
  154. # Failure analyzers
  155. org.springframework.boot.diagnostics.FailureAnalyzer=\
  156. org.springframework.boot.autoconfigure.data.redis.RedisUrlSyntaxFailureAnalyzer,\
  157. org.springframework.boot.autoconfigure.diagnostics.analyzer.NoSuchBeanDefinitionFailureAnalyzer,\
  158. org.springframework.boot.autoconfigure.flyway.FlywayMigrationScriptMissingFailureAnalyzer,\
  159. org.springframework.boot.autoconfigure.jdbc.DataSourceBeanCreationFailureAnalyzer,\
  160. org.springframework.boot.autoconfigure.jdbc.HikariDriverConfigurationFailureAnalyzer,\
  161. org.springframework.boot.autoconfigure.jooq.NoDslContextBeanFailureAnalyzer,\
  162. org.springframework.boot.autoconfigure.r2dbc.ConnectionFactoryBeanCreationFailureAnalyzer,\
  163. org.springframework.boot.autoconfigure.r2dbc.MissingR2dbcPoolDependencyFailureAnalyzer,\
  164. org.springframework.boot.autoconfigure.r2dbc.MultipleConnectionPoolConfigurationsFailureAnalzyer,\
  165. org.springframework.boot.autoconfigure.r2dbc.NoConnectionFactoryBeanFailureAnalyzer,\
  166. org.springframework.boot.autoconfigure.session.NonUniqueSessionRepositoryFailureAnalyzer
  167. # Template availability providers
  168. org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\
  169. org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider,\
  170. org.springframework.boot.autoconfigure.mustache.MustacheTemplateAvailabilityProvider,\
  171. org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAvailabilityProvider,\
  172. org.springframework.boot.autoconfigure.thymeleaf.ThymeleafTemplateAvailabilityProvider,\
  173. org.springframework.boot.autoconfigure.web.servlet.JspTemplateAvailabilityProvider
  174. # DataSource initializer detectors
  175. org.springframework.boot.sql.init.dependency.DatabaseInitializerDetector=\
  176. org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializerDatabaseInitializerDetector
  177. # Depends on database initialization detectors
  178. org.springframework.boot.sql.init.dependency.DependsOnDatabaseInitializationDetector=\
  179. org.springframework.boot.autoconfigure.batch.JobRepositoryDependsOnDatabaseInitializationDetector,\
  180. org.springframework.boot.autoconfigure.quartz.SchedulerDependsOnDatabaseInitializationDetector,\
  181. org.springframework.boot.autoconfigure.session.JdbcIndexedSessionRepositoryDependsOnDatabaseInitializationDetector