前言

Spring Boot的自动装配也是利用了Java SPI思想,与JDK提供的方式不同之处在于Spring Boot更为优雅的引入了注解,通过自定义加载实现的方式完成自动装配,约定大于配置,做到了开箱即用,一键启动。

装配原理分析

Spring Boot的自动装配本质是通过注解扫描+SPI思想来实现,接下来就通过核心注解原理及实际案例演示来展开分析。

注解分析

Spring Boot应用从一个注解@SpringBootApplication开始,这个注解是一个合成注解,包含以下三个注解:

  • @SpringBootConfiguration
  • @EnableAutoConfiguration
  • @ComponentScan

    @SpringBootConfiguration

    通过源码可以看到这个注解内部只包含一个@Configuration注解,来标注这是这个配置类。

    1. @Target({ElementType.TYPE})
    2. @Retention(RetentionPolicy.RUNTIME)
    3. @Documented
    4. @Configuration
    5. @Indexed
    6. public @interface SpringBootConfiguration {
    7. @AliasFor(
    8. annotation = Configuration.class
    9. )
    10. boolean proxyBeanMethods() default true;
    11. }

    @ComponentScan

    这个注解主要进行标注一个Spring Boot应用的包扫描范围,默认扫描组件包含主程序所在的同一级别或者子包所在的范围。
    包路径默认规则由AutoConfigurationExcludeFilter类来实现。

    @EnableAutoConfiguration

    Spring Boot自动配置的功能主要由这个注解来实现,实现自动加载不同的场景依赖,查看源码

    1. @Target({ElementType.TYPE})
    2. @Retention(RetentionPolicy.RUNTIME)
    3. @Documented
    4. @Inherited
    5. @AutoConfigurationPackage
    6. @Import({AutoConfigurationImportSelector.class})
    7. public @interface EnableAutoConfiguration {
    8. String ENABLED_OVERRIDE_PROPERTY = "spring.boot.enableautoconfiguration";
    9. Class<?>[] exclude() default {};
    10. String[] excludeName() default {};
    11. }

这里包含了@AutoConfigurationPackage注解和导入了一个类,这里属于@Import注解的高级用法,先查看@AutoConfigurationPackage这个注解的源码

  1. @Target({ElementType.TYPE})
  2. @Retention(RetentionPolicy.RUNTIME)
  3. @Documented
  4. @Inherited
  5. @Import({Registrar.class})
  6. public @interface AutoConfigurationPackage {
  7. String[] basePackages() default {};
  8. Class<?>[] basePackageClasses() default {};
  9. }

通过一个Registrar来对包进行自动配置,查看Registrar源码内容

  1. static class Registrar implements ImportBeanDefinitionRegistrar, DeterminableImports {
  2. Registrar() {
  3. }
  4. public void registerBeanDefinitions(AnnotationMetadata metadata, BeanDefinitionRegistry registry) {
  5. AutoConfigurationPackages.register(registry, (String[])(new AutoConfigurationPackages.PackageImports(metadata)).getPackageNames().toArray(new String[0]));
  6. }
  7. public Set<Object> determineImports(AnnotationMetadata metadata) {
  8. return Collections.singleton(new AutoConfigurationPackages.PackageImports(metadata));
  9. }
  10. }

也就是说当SpringBoot应用启动时默认会将启动类所在的package作为自动配置的package,来扫描加载应用内部的组件,如果包名需要自定义这时就可以使用@ComponentScan注解来指定。

除了自动包管理之外,Spring Boot应用在启动时还有默认组件需要进行加载,这里主要依靠@EnableAutoConfiguration注解中导入的AutoConfigurationImportSelector类来完成。查看主要源码流程。

  1. 通过selectImports方法来返回需要加载的自动配置类组件数组。

    1. public String[] selectImports(AnnotationMetadata annotationMetadata) {
    2. if (!this.isEnabled(annotationMetadata)) {
    3. return NO_IMPORTS;
    4. } else {
    5. AutoConfigurationImportSelector.AutoConfigurationEntry autoConfigurationEntry = this.getAutoConfigurationEntry(annotationMetadata);
    6. return StringUtils.toStringArray(autoConfigurationEntry.getConfigurations());
    7. }
    8. }
  2. 通过getAutoConfigurationEntry方法获取需要被自动配置的entry信息

    1. protected AutoConfigurationImportSelector.AutoConfigurationEntry getAutoConfigurationEntry(AnnotationMetadata annotationMetadata) {
    2. if (!this.isEnabled(annotationMetadata)) {
    3. return EMPTY_ENTRY;
    4. } else {
    5. AnnotationAttributes attributes = this.getAttributes(annotationMetadata);
    6. List<String> configurations = this.getCandidateConfigurations(annotationMetadata, attributes);
    7. configurations = this.removeDuplicates(configurations);
    8. Set<String> exclusions = this.getExclusions(annotationMetadata, attributes);
    9. this.checkExcludedClasses(configurations, exclusions);
    10. configurations.removeAll(exclusions);
    11. configurations = this.getConfigurationClassFilter().filter(configurations);
    12. this.fireAutoConfigurationImportEvents(configurations, exclusions);
    13. return new AutoConfigurationImportSelector.AutoConfigurationEntry(configurations, exclusions);
    14. }
    15. }
  3. 获取候选加载的组件信息,通过代码追踪可以看到,在应用启动过程中,Spring Boot会默认加载classpath下META-INF/spring.factories中所配置的entry信息。

    1. protected List<String> getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) {
    2. List<String> configurations = SpringFactoriesLoader.loadFactoryNames(this.getSpringFactoriesLoaderFactoryClass(), this.getBeanClassLoader());
    3. Assert.notEmpty(configurations, "No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.");
    4. return configurations;
    5. }
  4. 通过loadFactoryNames方法来加载自动配置类信息

    1. public static List<String> loadFactoryNames(Class<?> factoryType, @Nullable ClassLoader classLoader) {
    2. ClassLoader classLoaderToUse = classLoader;
    3. if (classLoader == null) {
    4. classLoaderToUse = SpringFactoriesLoader.class.getClassLoader();
    5. }
    6. String factoryTypeName = factoryType.getName();
    7. return (List)loadSpringFactories(classLoaderToUse).getOrDefault(factoryTypeName, Collections.emptyList());
    8. }
  5. 此处可以看到从META-INF/spring.factories文件中获取需要被加载的配置信息

    1. private static Map<String, List<String>> loadSpringFactories(ClassLoader classLoader) {
    2. Map<String, List<String>> result = cache.get(classLoader);
    3. if (result != null) {
    4. return result;
    5. }
    6. result = new HashMap<>();
    7. try {
    8. Enumeration<URL> urls = classLoader.getResources(FACTORIES_RESOURCE_LOCATION);
    9. while (urls.hasMoreElements()) {
    10. URL url = urls.nextElement();
    11. UrlResource resource = new UrlResource(url);
    12. Properties properties = PropertiesLoaderUtils.loadProperties(resource);
    13. for (Map.Entry<?, ?> entry : properties.entrySet()) {
    14. String factoryTypeName = ((String) entry.getKey()).trim();
    15. String[] factoryImplementationNames =
    16. StringUtils.commaDelimitedListToStringArray((String) entry.getValue());
    17. for (String factoryImplementationName : factoryImplementationNames) {
    18. result.computeIfAbsent(factoryTypeName, key -> new ArrayList<>())
    19. .add(factoryImplementationName.trim());
    20. }
    21. }
    22. }
    23. // Replace all lists with unmodifiable lists containing unique elements
    24. result.replaceAll((factoryType, implementations) -> implementations.stream().distinct()
    25. .collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList)));
    26. cache.put(classLoader, result);
    27. }
    28. catch (IOException ex) {
    29. throw new IllegalArgumentException("Unable to load factories from location [" +
    30. FACTORIES_RESOURCE_LOCATION + "]", ex);
    31. }
    32. return result;
    33. }

Spring Boot starter所包含的127个场景启动器都被写入在spring.factories中,这些就是需要在项目启动时被加载的entry信息,包括常见的AOP组件,Spring MVC组件,如果是web应用在项目启动时会使用默认配置被加载到Spring容器中。

案例分析

但是这么多组件都会被加载吗?并不是,这里只是列举出来需要被自动配置的组件信息,具体什么时候加载,Spring Boot会按需加载,这里以AOP和RabbitMQ的自配配置为例。

AOP自动配置

查看源码AopAutoConfiguration

  1. @ConditionalOnProperty(
  2. prefix = "spring.aop",
  3. name = {"auto"},
  4. havingValue = "true",
  5. matchIfMissing = true
  6. )

这里说明了只有当配置文件中指定了属性spring.aop.auto为true时,并且不指定也默认为true,从这里也可以看出AOP配置组件是默认生效的。

amqp自动配置

查看源码RabbitAnnotationDrivenConfiguration

  1. @ConditionalOnClass({EnableRabbit.class})
  2. ...省略

从类注解就可以看出只有存在EnableRabbit类相关的bean时才会进行下面的自动配置,如果maven中就没有相关的依赖,自然就不会进行加载装配,这也提现了Spring Boot的巧妙之处,此外源码也提现了设计的规范统一,只要是场景启动器starter都会存在xxxAutoConfiguration这样的自动配置类,一般也伴随着xxxProperties这样可以与application.yml中自定义配置绑定的配置类。

总结

Spring Boot的自动装配原理借鉴了Java SPI机制,简单总结就是,自动管理,按需加载。

  1. @SpringBootApplication标明启动主程序,可以使用exclude属性来排除需要进行自动装配的组件,使用scanBasePackages来指明需要扫描的包。
  2. @SpringBootApplication —> @EnableAutoConfiguration —>@AutoConfigurationPackage进行自动包管理,加载应用内相关组件。
  3. 通过流程,类AutoConfigurationImportSelector —> 方法selectImports —> 方法getAutoConfigurationEntry —> 方法getCandidateConfigurations —> 方法loadFactoryNames —> 方法loadSpringFactories —> 文件META-INF/spring.factories来获取需要被加载的entry信息,然后根据组件的自动配置类中的@Conditionxxx注解来判断配置是否生效,按需加载

    spring.factories中包含的自动配置entry信息
  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