{"id":4385,"date":"2021-12-05T12:14:05","date_gmt":"2021-12-05T04:14:05","guid":{"rendered":"http:\/\/123.57.164.21\/?p=4385"},"modified":"2021-12-05T12:14:05","modified_gmt":"2021-12-05T04:14:05","slug":"spring-boot%e8%87%aa%e5%8a%a8%e9%85%8d%e7%bd%ae%e5%8e%9f%e7%90%86","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=4385","title":{"rendered":"Spring Boot\u81ea\u52a8\u914d\u7f6e\u539f\u7406"},"content":{"rendered":"\n<p>\u6211\u4eec\u77e5\u9053\uff0cSpring Boot \u9879\u76ee\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u5373\u4f7f\u4e0d\u8fdb\u884c\u4efb\u4f55\u7684\u914d\u7f6e\uff0c\u4e5f\u80fd\u591f\u987a\u5229\u5730\u8fd0\u884c\uff0c\u8fd9\u90fd\u8981\u5f52\u529f\u4e8e Spring Boot \u7684\u81ea\u52a8\u5316\u914d\u7f6e\u3002<br><br>Spring Boot \u9ed8\u8ba4\u4f7f\u7528 application.properties \u6216 application.yml \u4f5c\u4e3a\u5176\u5168\u5c40\u914d\u7f6e\u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u8be5\u914d\u7f6e\u6587\u4ef6\u4e2d\u5bf9\u5404\u79cd\u81ea\u52a8\u914d\u7f6e\u5c5e\u6027\uff08server.port\u3001logging.level.* \u3001spring.config.active.no-profile \u7b49\u7b49\uff09\u8fdb\u884c\u4fee\u6539\uff0c\u5e76\u4f7f\u4e4b\u751f\u6548\uff0c\u90a3\u4e48\u60a8\u6709\u6ca1\u6709\u60f3\u8fc7\u8fd9\u4e9b\u5c5e\u6027\u662f\u5426\u6709\u636e\u53ef\u4f9d\u5462\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\u3002<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/docs.spring.io\/spring-boot\/docs\/current\/reference\/htmlsingle\/#application-properties\" target=\"_blank\">Spring Boot \u5b98\u65b9\u6587\u6863\uff1a\u5e38\u89c1\u5e94\u7528\u5c5e\u6027<\/a>\u4e2d\u5bf9\u6240\u6709\u7684\u914d\u7f6e\u5c5e\u6027\u90fd\u8fdb\u884c\u4e86\u5217\u4e3e\u548c\u89e3\u91ca\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u5b98\u65b9\u6587\u6863\u5bf9 Spring Boot \u8fdb\u884c\u914d\u7f6e\uff0c\u4f46 Spring Boot \u4e2d\u7684\u914d\u7f6e\u5c5e\u6027\u6570\u91cf\u5e9e\u5927\uff0c\u4ec5\u4ec5\u4f9d\u9760\u5b98\u65b9\u6587\u6863\u8fdb\u884c\u914d\u7f6e\u4e5f\u5341\u5206\u9ebb\u70e6\u3002\u6211\u4eec\u53ea\u6709\u4e86\u89e3\u4e86 Spring Boot \u81ea\u52a8\u914d\u7f6e\u7684\u539f\u7406\uff0c\u624d\u80fd\u66f4\u52a0\u8f7b\u677e\u719f\u7ec3\u5730\u5bf9 Spirng Boot \u8fdb\u884c\u914d\u7f6e\u3002\u672c\u8282\u4e3a\u4f60\u63ed\u5f00 SpringBoot \u81ea\u52a8\u914d\u7f6e\u7684\u795e\u79d8\u9762\u7eb1\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Spring Factories \u673a\u5236<\/h5>\n\n\n\n<p>Spring Boot \u7684\u81ea\u52a8\u914d\u7f6e\u662f\u57fa\u4e8e Spring Factories \u673a\u5236\u5b9e\u73b0\u7684\u3002<br><br>Spring Factories \u673a\u5236\u662f Spring Boot \u4e2d\u7684\u4e00\u79cd\u670d\u52a1\u53d1\u73b0\u673a\u5236\uff0c\u8fd9\u79cd\u6269\u5c55\u673a\u5236\u4e0e Java SPI \u673a\u5236\u5341\u5206\u76f8\u4f3c\u3002Spring Boot \u4f1a\u81ea\u52a8\u626b\u63cf\u6240\u6709 Jar \u5305\u7c7b\u8def\u5f84\u4e0b META-INF\/spring.factories \u6587\u4ef6\uff0c\u5e76\u8bfb\u53d6\u5176\u4e2d\u7684\u5185\u5bb9\uff0c\u8fdb\u884c\u5b9e\u4f8b\u5316\uff0c\u8fd9\u79cd\u673a\u5236\u4e5f\u662f Spring Boot Starter \u7684\u57fa\u7840\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">spring.factories<\/h5>\n\n\n\n<p>spring.factories \u6587\u4ef6\u672c\u8d28\u4e0a\u4e0e properties \u6587\u4ef6\u76f8\u4f3c\uff0c\u5176\u4e2d\u5305\u542b\u4e00\u7ec4\u6216\u591a\u7ec4\u952e\u503c\u5bf9\uff08key=vlaue\uff09\uff0c\u5176\u4e2d\uff0ckey \u7684\u53d6\u503c\u4e3a\u63a5\u53e3\u7684\u5b8c\u5168\u9650\u5b9a\u540d\uff1bvalue \u7684\u53d6\u503c\u4e3a\u63a5\u53e3\u5b9e\u73b0\u7c7b\u7684\u5b8c\u5168\u9650\u5b9a\u540d\uff0c\u4e00\u4e2a\u63a5\u53e3\u53ef\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u5b9e\u73b0\u7c7b\uff0c\u4e0d\u540c\u5b9e\u73b0\u7c7b\u4e4b\u95f4\u4f7f\u7528\u201c\uff0c\u201d\u9694\u5f00\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    org.springframework.boot.autoconfigure.AutoConfigurationImportFilter=\\\n    org.springframework.boot.autoconfigure.condition.OnBeanCondition,\\\n    org.springframework.boot.autoconfigure.condition.OnClassCondition,\\\n    org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-108-1024x48.png\" alt=\"\" class=\"wp-image-4386\" width=\"686\" height=\"32\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-108-1024x48.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-108-300x14.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-108-768x36.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-108-1536x72.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-108-830x39.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-108-230x11.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-108-350x16.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-108-480x23.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-108.png 1784w\" sizes=\"(max-width: 686px) 100vw, 686px\" \/><\/figure><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">Spring Factories \u5b9e\u73b0\u539f\u7406<\/h5>\n\n\n\n<p>spring-core \u5305\u91cc\u5b9a\u4e49\u4e86 SpringFactoriesLoader \u7c7b\uff0c\u8fd9\u4e2a\u7c7b\u4f1a\u626b\u63cf\u6240\u6709 Jar \u5305\u7c7b\u8def\u5f84\u4e0b\u7684 META-INF\/spring.factories \u6587\u4ef6\uff0c\u5e76\u83b7\u53d6\u6307\u5b9a\u63a5\u53e3\u7684\u914d\u7f6e\u3002\u5728 SpringFactoriesLoader\u00a0\u7c7b\u4e2d\u5b9a\u4e49\u4e86\u4e24\u4e2a\u5bf9\u5916\u7684\u65b9\u6cd5\uff0c\u5982\u4e0b\u8868\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-109-1024x244.png\" alt=\"\" class=\"wp-image-4388\" width=\"550\" height=\"131\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-109-1024x244.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-109-300x72.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-109-768x183.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-109-830x198.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-109-230x55.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-109-350x84.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-109-480x115.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-109.png 1148w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/figure><\/div>\n\n\n\n<p>\u4ee5\u4e0a\u4e24\u4e2a\u65b9\u6cd5\u7684\u5173\u952e\u90fd\u662f\u4ece\u6307\u5b9a\u7684 ClassLoader \u4e2d\u83b7\u53d6 spring.factories \u6587\u4ef6\uff0c\u5e76\u89e3\u6790\u5f97\u5230\u7c7b\u540d\u5217\u8868\uff0c\u5177\u4f53\u4ee3\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<p>loadFactories() \u65b9\u6cd5\u80fd\u591f\u83b7\u53d6\u6307\u5b9a\u63a5\u53e3\u7684\u5b9e\u73b0\u7c7b\u5bf9\u8c61\uff0c\u5177\u4f53\u4ee3\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    public static &lt;T> List&lt;T> loadFactories(Class&lt;T> factoryType, @Nullable ClassLoader classLoader) {\n        Assert.notNull(factoryType, \"'factoryType' must not be null\");\n        ClassLoader classLoaderToUse = classLoader;\n        if (classLoader == null) {\n            classLoaderToUse = SpringFactoriesLoader.class.getClassLoader();\n        }\n        \/\/ \u8c03\u7528loadFactoryNames\u83b7\u53d6\u63a5\u53e3\u7684\u5b9e\u73b0\u7c7b\n        List&lt;String> factoryImplementationNames = loadFactoryNames(factoryType, classLoaderToUse);\n        if (logger.isTraceEnabled()) {\n            logger.trace(\"Loaded [\" + factoryType.getName() + \"] names: \" + factoryImplementationNames);\n        }\n        \/\/ \u904d\u5386 factoryNames \u6570\u7ec4\uff0c\u521b\u5efa\u5b9e\u73b0\u7c7b\u7684\u5bf9\u8c61\n        List&lt;T> result = new ArrayList(factoryImplementationNames.size());\n        Iterator var5 = factoryImplementationNames.iterator();\n        \/\/\u6392\u5e8f\n        while(var5.hasNext()) {\n            String factoryImplementationName = (String)var5.next();\n            result.add(instantiateFactory(factoryImplementationName, factoryType, classLoaderToUse));\n        }\n        AnnotationAwareOrderComparator.sort(result);\n        return result;\n    }<\/pre>\n\n\n\n<p>loadFactoryNames() \u65b9\u6cd5\u80fd\u591f\u6839\u636e\u63a5\u53e3\u83b7\u53d6\u5176\u5b9e\u73b0\u7c7b\u7c7b\u540d\u7684\u96c6\u5408\uff0c\u5177\u4f53\u4ee3\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    public static List&lt;String> loadFactoryNames(Class&lt;?> factoryType, @Nullable ClassLoader classLoader) {\n        ClassLoader classLoaderToUse = classLoader;\n        if (classLoader == null) {\n            classLoaderToUse = SpringFactoriesLoader.class.getClassLoader();\n        }\n        String factoryTypeName = factoryType.getName();\n        \/\/\u83b7\u53d6\u81ea\u52a8\u914d\u7f6e\u7c7b\n        return (List)loadSpringFactories(classLoaderToUse).getOrDefault(factoryTypeName, Collections.emptyList());\n    }<\/pre>\n\n\n\n<p>loadSpringFactories() \u65b9\u6cd5\u80fd\u591f\u8bfb\u53d6\u8be5\u9879\u76ee\u4e2d\u6240\u6709 Jar \u5305\u7c7b\u8def\u5f84\u4e0b META-INF\/spring.factories \u6587\u4ef6\u7684\u914d\u7f6e\u5185\u5bb9\uff0c\u5e76\u4ee5 Map \u96c6\u5408\u7684\u5f62\u5f0f\u8fd4\u56de\uff0c\u5177\u4f53\u4ee3\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    private static Map&lt;String, List&lt;String>> loadSpringFactories(ClassLoader classLoader) {\n        Map&lt;String, List&lt;String>> result = (Map)cache.get(classLoader);\n        if (result != null) {\n            return result;\n        } else {\n            HashMap result = new HashMap();\n        try {\n            \/\/\u626b\u63cf\u6240\u6709 Jar \u5305\u7c7b\u8def\u5f84\u4e0b\u7684 META-INF\/spring.factories \u6587\u4ef6\n            Enumeration urls = classLoader.getResources(\"META-INF\/spring.factories\");\n            while(urls.hasMoreElements()) {\n                    URL url = (URL)urls.nextElement();\n                    UrlResource resource = new UrlResource(url);\n                    \/\/\u5c06\u626b\u63cf\u5230\u7684 META-INF\/spring.factories \u6587\u4ef6\u4e2d\u5185\u5bb9\u5305\u88c5\u6210 properties \u5bf9\u8c61\n                    Properties properties = PropertiesLoaderUtils.loadProperties(resource);\n                    Iterator var6 = properties.entrySet().iterator();\n                    while(var6.hasNext()) {\n                        Map.Entry&lt;?, ?> entry = (Map.Entry)var6.next();\n                        \/\/\u63d0\u53d6 properties \u5bf9\u8c61\u4e2d\u7684 key \u503c\n                        String factoryTypeName = ((String)entry.getKey()).trim();\n                        \/\/\u63d0\u53d6 proper \u5bf9\u8c61\u4e2d\u7684 value \u503c\uff08\u591a\u4e2a\u7c7b\u7684\u5b8c\u5168\u9650\u5b9a\u540d\u4f7f\u7528\u9017\u53f7\u8fde\u63a5\u7684\u5b57\u7b26\u4e32\uff09\n                        \/\/ \u4f7f\u7528\u9017\u53f7\u4e3a\u5206\u9694\u7b26\u8f6c\u6362\u4e3a\u6570\u7ec4\uff0c\u6570\u7ec4\u5185\u6bcf\u4e2a\u5143\u7d20\u90fd\u662f\u914d\u7f6e\u7c7b\u7684\u5b8c\u5168\u9650\u5b9a\u540d\n                        String[] factoryImplementationNames = StringUtils.commaDelimitedListToStringArray((String)entry.getValue());\n                        String[] var10 = factoryImplementationNames;\n                        int var11 = factoryImplementationNames.length;\n                        \/\/\u904d\u5386\u914d\u7f6e\u7c7b\u6570\u7ec4\uff0c\u5e76\u5c06\u6570\u7ec4\u8f6c\u6362\u4e3a list \u96c6\u5408\n                        for(int var12 = 0; var12 &lt; var11; ++var12) {\n                            String factoryImplementationName = var10[var12];\n                            ((List)result.computeIfAbsent(factoryTypeName, (key) -> {\n                                return new ArrayList();\n                            })).add(factoryImplementationName.trim());\n                        }\n                    }\n                }\n                \/\/\u5c06 propertise \u5bf9\u8c61\u7684 key \u4e0e\u7531\u914d\u7f6e\u7c7b\u7ec4\u6210\u7684 List \u96c6\u5408\u4e00\u4e00\u5bf9\u5e94\u5b58\u5165\u540d\u4e3a result \u7684 Map \u4e2d\n                result.replaceAll((factoryType, implementations) -> {\n                    return (List)implementations.stream().distinct().collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));\n                });\n                cache.put(classLoader, result);\n                \/\/\u8fd4\u56de result\n                return result;\n            } catch (IOException var14) {\n                throw new IllegalArgumentException(\"Unable to load factories from location [META-INF\/spring.factories]\", var14);\n            }\n         }\n    }<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u81ea\u52a8\u914d\u7f6e\u7684\u52a0\u8f7d<\/h5>\n\n\n\n<p>Spring Boot \u81ea\u52a8\u5316\u914d\u7f6e\u4e5f\u662f\u57fa\u4e8e Spring Factories \u673a\u5236\u5b9e\u73b0\u7684\uff0c\u5728\u00a0spring-boot-autoconfigure-xxx.jar \u7c7b\u8def\u5f84\u4e0b\u7684 META-INF\/spring.factories \u4e2d\u8bbe\u7f6e\u4e86 Spring Boot \u81ea\u52a8\u914d\u7f6e\u7684\u5185\u5bb9 \uff0c\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    # Auto Configure\n    org.springframework.boot.autoconfigure.EnableAutoConfiguration=\\\n    org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.aop.AopAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.context.LifecycleAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.cassandra.CassandraReactiveDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.cassandra.CassandraReactiveRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.cassandra.CassandraRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.couchbase.CouchbaseReactiveRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.couchbase.CouchbaseRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRestClientAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.ldap.LdapRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.mongo.MongoReactiveRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.neo4j.Neo4jReactiveDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.neo4j.Neo4jReactiveRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.r2dbc.R2dbcDataAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.r2dbc.R2dbcRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.influx.InfluxDbAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.jsonb.JsonbAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.r2dbc.R2dbcTransactionManagerAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.rsocket.RSocketMessagingAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.rsocket.RSocketRequesterAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.rsocket.RSocketServerAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.rsocket.RSocketStrategiesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.reactive.ReactiveUserDetailsServiceAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.rsocket.RSocketSecurityAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.saml2.Saml2RelyingPartyAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.sendgrid.SendGridAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.session.SessionAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.reactive.ReactiveWebServerFactoryAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.websocket.reactive.WebSocketReactiveAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.websocket.servlet.WebSocketMessagingAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.webservices.WebServicesAutoConfiguration,\\\n    org.springframework.boot.autoconfigure.webservices.client.WebServiceTemplateAutoConfiguration<\/pre>\n\n\n\n<p>\u4ee5\u4e0a\u914d\u7f6e\u4e2d\uff0cvalue \u53d6\u503c\u662f\u7531\u591a\u4e2a xxxAutoConfiguration \uff08\u4f7f\u7528\u9017\u53f7\u5206\u9694\uff09\u7ec4\u6210\uff0c\u6bcf\u4e2a xxxAutoConfiguration \u90fd\u662f\u4e00\u4e2a\u81ea\u52a8\u914d\u7f6e\u7c7b\u3002Spring Boot \u542f\u52a8\u65f6\uff0c\u4f1a\u5229\u7528 Spring-Factories \u673a\u5236\uff0c\u5c06\u8fd9\u4e9b xxxAutoConfiguration \u5b9e\u4f8b\u5316\u5e76\u4f5c\u4e3a\u7ec4\u4ef6\u52a0\u5165\u5230\u5bb9\u5668\u4e2d\uff0c\u4ee5\u5b9e\u73b0 Spring Boot \u7684\u81ea\u52a8\u914d\u7f6e\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">@SpringBootApplication \u6ce8\u89e3<\/h5>\n\n\n\n<p>\u6240\u6709 Spring Boot \u9879\u76ee\u7684\u4e3b\u542f\u52a8\u7a0b\u5e8f\u7c7b\u4e0a\u90fd\u4f7f\u7528\u4e86\u4e00\u4e2a\u00a0@SpringBootApplication \u6ce8\u89e3\uff0c\u8be5\u6ce8\u89e3\u662f Spring Boot \u4e2d\u6700\u91cd\u8981\u7684\u6ce8\u89e3\u4e4b\u4e00 \uff0c\u4e5f\u662f Spring Boot \u5b9e\u73b0\u81ea\u52a8\u5316\u914d\u7f6e\u7684\u5173\u952e\u3002\u00a0<br><br>@SpringBootApplication \u662f\u4e00\u4e2a\u7ec4\u5408\u5143\u6ce8\u89e3\uff0c\u5176\u4e3b\u8981\u5305\u542b\u4e24\u4e2a\u6ce8\u89e3\uff1a@SpringBootConfiguration \u548c @EnableAutoConfiguration\uff0c\u5176\u4e2d @EnableAutoConfiguration \u6ce8\u89e3\u662f SpringBoot \u81ea\u52a8\u5316\u914d\u7f6e\u7684\u6838\u5fc3\u6240\u5728\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-110.png\" alt=\"\" class=\"wp-image-4389\" width=\"479\" height=\"376\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-110.png 814w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-110-300x235.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-110-768x602.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-110-230x180.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-110-350x274.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-110-480x376.png 480w\" sizes=\"(max-width: 479px) 100vw, 479px\" \/><\/figure><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">@EnableAutoConfiguration \u6ce8\u89e3<\/h5>\n\n\n\n<p>@EnableAutoConfiguration \u6ce8\u89e3\u7528\u4e8e\u5f00\u542f Spring Boot \u7684\u81ea\u52a8\u914d\u7f6e\u529f\u80fd\uff0c \u5b83\u4f7f\u7528 Spring \u6846\u67b6\u63d0\u4f9b\u7684 @Import \u6ce8\u89e3\u901a\u8fc7 AutoConfigurationImportSelector\u7c7b\uff08\u9009\u62e9\u5668\uff09\u7ed9\u5bb9\u5668\u4e2d\u5bfc\u5165\u81ea\u52a8\u914d\u7f6e\u7ec4\u4ef6\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-111-1024x497.png\" alt=\"\" class=\"wp-image-4390\" width=\"601\" height=\"291\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-111-1024x497.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-111-300x146.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-111-768x373.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-111-830x403.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-111-230x112.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-111-350x170.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-111-480x233.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-111.png 1088w\" sizes=\"(max-width: 601px) 100vw, 601px\" \/><\/figure><\/div>\n\n\n\n<h5 class=\"wp-block-heading\">AutoConfigurationImportSelector \u7c7b<\/h5>\n\n\n\n<p>AutoConfigurationImportSelector \u7c7b\u5b9e\u73b0\u4e86 DeferredImportSelector \u63a5\u53e3\uff0cAutoConfigurationImportSelector \u4e2d\u8fd8\u5305\u542b\u4e00\u4e2a\u9759\u6001\u5185\u90e8\u7c7b AutoConfigurationGroup\uff0c\u5b83\u5b9e\u73b0\u4e86 DeferredImportSelector \u63a5\u53e3\u7684\u5185\u90e8\u63a5\u53e3 Group\uff08Spring 5 \u65b0\u589e\uff09\u3002<br><br>AutoConfigurationImportSelector \u7c7b\u4e2d\u5305\u542b 3 \u4e2a\u65b9\u6cd5\uff0c\u5982\u4e0b\u8868\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-112-1024x194.png\" alt=\"\" class=\"wp-image-4391\" width=\"673\" height=\"127\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-112-1024x194.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-112-300x57.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-112-768x146.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-112-1536x291.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-112-830x157.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-112-230x44.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-112-350x66.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-112-480x91.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-112.png 1804w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/figure><\/div>\n\n\n\n<p>AutoConfigurationImportSelector \u5185\u5404\u65b9\u6cd5\u6267\u884c\u987a\u5e8f\u5982\u4e0b\u3002<\/p>\n\n\n\n<ol><li>getImportGroup() \u65b9\u6cd5<\/li><li>process() \u65b9\u6cd5<\/li><li>selectImports() \u65b9\u6cd5<\/li><\/ol>\n\n\n\n<p>\u4e0b\u9762\u6211\u4eec\u5c06\u5206\u522b\u5bf9\u4ee5\u4e0a 3 \u4e2a\u65b9\u6cd5\u53ca\u5176\u8c03\u7528\u8fc7\u7a0b\u8fdb\u884c\u4ecb\u7ecd\u3002<\/p>\n\n\n\n<p><strong>1. getImportGroup() \u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p>AutoConfigurationImportSelector \u7c7b\u4e2d getImportGroup() \u65b9\u6cd5\u4e3b\u8981\u7528\u4e8e\u83b7\u53d6\u5b9e\u73b0\u4e86 DeferredImportSelector.Group \u63a5\u53e3\u7684\u7c7b\uff0c\u4ee3\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">        public Class&lt;? extends Group> getImportGroup() {\n            \/\/\u83b7\u53d6\u5b9e\u73b0\u4e86 DeferredImportSelector.Gorup \u63a5\u53e3\u7684 AutoConfigurationImportSelector.AutoConfigurationGroup \u7c7b\n            return AutoConfigurationImportSelector.AutoConfigurationGroup.class;\n        }<\/pre>\n\n\n\n<p><strong>2. process() \u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p>\u9759\u6001\u5185\u90e8\u7c7b AutoConfigurationGroup \u4e2d\u7684\u6838\u5fc3\u65b9\u6cd5\u662f process()\uff0c\u8be5\u65b9\u6cd5\u901a\u8fc7\u8c03\u7528 getAutoConfigurationEntry() \u65b9\u6cd5\u8bfb\u53d6 spring.factories \u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\uff0c\u83b7\u5f97\u81ea\u52a8\u914d\u7f6e\u7c7b\u7684\u96c6\u5408\uff0c\u4ee3\u7801\u5982\u4e0b \u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    public void process(AnnotationMetadata annotationMetadata, DeferredImportSelector deferredImportSelector) {\n        Assert.state(deferredImportSelector instanceof AutoConfigurationImportSelector, () -> {\n            return String.format(\"Only %s implementations are supported, got %s\", AutoConfigurationImportSelector.class.getSimpleName(), deferredImportSelector.getClass().getName());\n        });\n        \/\/\u62ff\u5230 META-INF\/spring.factories\u4e2d\u7684EnableAutoConfiguration\uff0c\u5e76\u505a\u6392\u9664\u3001\u8fc7\u6ee4\u5904\u7406\n        \/\/AutoConfigurationEntry\u91cc\u6709\u9700\u8981\u5f15\u5165\u914d\u7f6e\u7c7b\u548c\u6392\u9664\u6389\u7684\u914d\u7f6e\u7c7b\uff0c\u6700\u7ec8\u53ea\u8981\u8fd4\u56de\u9700\u8981\u914d\u7f6e\u7684\u914d\u7f6e\u7c7b\n        AutoConfigurationImportSelector.AutoConfigurationEntry autoConfigurationEntry = ((AutoConfigurationImportSelector)deferredImportSelector).getAutoConfigurationEntry(annotationMetadata);\n        \/\/\u52a0\u5165\u7f13\u5b58,List&lt;AutoConfigurationEntry>\u7c7b\u578b\n        this.autoConfigurationEntries.add(autoConfigurationEntry);\n        Iterator var4 = autoConfigurationEntry.getConfigurations().iterator();\n        while(var4.hasNext()) {\n            String importClassName = (String)var4.next();\n            \/\/\u52a0\u5165\u7f13\u5b58\uff0cMap&lt;String, AnnotationMetadata>\u7c7b\u578b\n            this.entries.putIfAbsent(importClassName, annotationMetadata);\n        }\n    }<\/pre>\n\n\n\n<p><br>getAutoConfigurationEntry() \u65b9\u6cd5\u901a\u8fc7\u8c03\u7528\u00a0getCandidateConfigurations() \u65b9\u6cd5\u6765\u83b7\u53d6\u81ea\u52a8\u914d\u7f6e\u7c7b\u7684\u5b8c\u5168\u9650\u5b9a\u540d\uff0c\u5e76\u5728\u7ecf\u8fc7\u6392\u9664\u3001\u8fc7\u6ee4\u7b49\u5904\u7406\u540e\uff0c\u5c06\u5176\u7f13\u5b58\u5230\u6210\u5458\u53d8\u91cf\u4e2d\uff0c\u5177\u4f53\u4ee3\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    protected AutoConfigurationImportSelector.AutoConfigurationEntry getAutoConfigurationEntry(AnnotationMetadata annotationMetadata) {\n        if (!this.isEnabled(annotationMetadata)) {\n            return EMPTY_ENTRY;\n        } else {\n            \/\/\u83b7\u53d6\u6ce8\u89e3\u5143\u6570\u636e\u4e2d\u7684\u5c5e\u6027\u8bbe\u7f6e\n            AnnotationAttributes attributes = this.getAttributes(annotationMetadata);\n            \/\/\u83b7\u53d6\u81ea\u52a8\u914d\u7f6e\u7c7b\n            List&lt;String> configurations = this.getCandidateConfigurations(annotationMetadata, attributes);\n            \/\/\u5220\u9664list \u96c6\u5408\u4e2d\u91cd\u590d\u7684\u914d\u7f6e\u7c7b\n            configurations = this.removeDuplicates(configurations);\n            \/\/\u83b7\u53d6\u98d8\u51fa\u5bfc\u5165\u7684\u914d\u7f6e\u7c7b\n            Set&lt;String> exclusions = this.getExclusions(annotationMetadata, attributes);\n            \/\/\u68c0\u67e5\u662f\u5426\u8fd8\u5b58\u5728\u6392\u9664\u914d\u7f6e\u7c7b\n            this.checkExcludedClasses(configurations, exclusions);\n            \/\/\u5220\u9664\u6392\u9664\u7684\u914d\u7f6e\u7c7b\n            configurations.removeAll(exclusions);\n            \/\/\u83b7\u53d6\u8fc7\u6ee4\u5668\uff0c\u8fc7\u6ee4\u914d\u7f6e\u7c7b\n            configurations = this.getConfigurationClassFilter().filter(configurations);\n            \/\/\u51fa\u53d1\u81ea\u52a8\u5316\u914d\u7f6e\u5bfc\u5165\u4e8b\u4ef6\n            this.fireAutoConfigurationImportEvents(configurations, exclusions);\n            return new AutoConfigurationImportSelector.AutoConfigurationEntry(configurations, exclusions);\n        }\n    }<\/pre>\n\n\n\n<p>\u5728 getCandidateConfigurations() \u65b9\u6cd5\u4e2d\uff0c\u6839\u636e Spring Factories \u673a\u5236\u8c03\u7528\u00a0SpringFactoriesLoader \u7684 loadFactoryNames() \u65b9\u6cd5\uff0c\u6839\u636e EnableAutoConfiguration.class \uff08\u81ea\u52a8\u914d\u7f6e\u63a5\u53e3\uff09\u83b7\u53d6\u5176\u5b9e\u73b0\u7c7b\uff08\u81ea\u52a8\u914d\u7f6e\u7c7b\uff09\u7684\u7c7b\u540d\u7684\u96c6\u5408\uff0c\u5982\u4e0b\u56fe\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-113-1024x172.png\" alt=\"\" class=\"wp-image-4392\" width=\"696\" height=\"117\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-113-1024x172.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-113-300x50.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-113-768x129.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-113-1536x257.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-113-830x139.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-113-230x39.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-113-350x59.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-113-480x80.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-113.png 1790w\" sizes=\"(max-width: 696px) 100vw, 696px\" \/><\/figure><\/div>\n\n\n\n<p><strong>3. process() \u65b9\u6cd5<\/strong><\/p>\n\n\n\n<p>\u4ee5\u4e0a\u6240\u6709\u65b9\u6cd5\u6267\u884c\u5b8c\u6210\u540e\uff0cAutoConfigurationImportSelector.AutoConfigurationGroup#selectImports() \u4f1a\u5c06 process() \u65b9\u6cd5\u5904\u7406\u540e\u5f97\u5230\u7684\u81ea\u52a8\u914d\u7f6e\u7c7b\uff0c\u8fdb\u884c\u8fc7\u6ee4\u3001\u6392\u9664\uff0c\u6700\u540e\u5c06\u6240\u6709\u81ea\u52a8\u914d\u7f6e\u7c7b\u6dfb\u52a0\u5230\u5bb9\u5668\u4e2d\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    public Iterable&lt;DeferredImportSelector.Group.Entry> selectImports() {\n        if (this.autoConfigurationEntries.isEmpty()) {\n            return Collections.emptyList();\n        } else {\n            \/\/\u83b7\u53d6\u6240\u6709\u9700\u8981\u6392\u9664\u7684\u914d\u7f6e\u7c7b\n            Set&lt;String> allExclusions = (Set)this.autoConfigurationEntries.stream().\n                    map(AutoConfigurationImportSelector.AutoConfigurationEntry::getExclusions).flatMap(Collection::stream).collect(Collectors.toSet());\n            \/\/\u83b7\u53d6\u6240\u6709\u7ecf\u8fc7\u81ea\u52a8\u5316\u914d\u7f6e\u8fc7\u6ee4\u5668\u7684\u914d\u7f6e\u7c7b\n            Set&lt;String> processedConfigurations = (Set)this.autoConfigurationEntries.stream().map(AutoConfigurationImportSelector.\n                    AutoConfigurationEntry::getConfigurations).flatMap(Collection::stream).collect(Collectors.toCollection(LinkedHashSet::new));\n            \/\/\u6392\u9664\u8fc7\u6ee4\u540e\u914d\u7f6e\u7c7b\u4e2d\u9700\u8981\u6392\u9664\u7684\u7c7b\n            processedConfigurations.removeAll(allExclusions);\n            return (Iterable)this.sortAutoConfigurations(processedConfigurations,\n                    this.getAutoConfigurationMetadata()).stream().map((importClassName) -> {\n                return new DeferredImportSelector.Group.Entry((AnnotationMetadata)this.entries.get(importClassName), importClassName);\n            }).collect(Collectors.toList());\n        }\n    }<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u81ea\u52a8\u914d\u7f6e\u7684\u751f\u6548\u548c\u4fee\u6539<\/h5>\n\n\n\n<p>spring.factories \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u81ea\u52a8\u914d\u7f6e\u7c7b\uff08xxxAutoConfiguration\uff09\uff0c\u90fd\u662f\u5fc5\u987b\u5728\u4e00\u5b9a\u7684\u6761\u4ef6\u4e0b\u624d\u4f1a\u4f5c\u4e3a\u7ec4\u4ef6\u6dfb\u52a0\u5230\u5bb9\u5668\u4e2d\uff0c\u914d\u7f6e\u7684\u5185\u5bb9\u624d\u4f1a\u751f\u6548\u3002\u8fd9\u4e9b\u9650\u5236\u6761\u4ef6\u5728 Spring Boot \u4e2d\u4ee5 @Conditional \u6d3e\u751f\u6ce8\u89e3\u7684\u5f62\u5f0f\u4f53\u73b0\uff0c\u5982\u4e0b\u8868\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2021\/12\/image-114.png\" alt=\"\" class=\"wp-image-4393\" width=\"468\" height=\"309\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-114.png 906w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-114-300x198.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-114-768x507.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-114-830x548.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-114-230x152.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-114-350x231.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2021\/12\/image-114-480x317.png 480w\" sizes=\"(max-width: 468px) 100vw, 468px\" \/><\/figure><\/div>\n\n\n\n<p>\u4e0b\u9762\u6211\u4eec\u4ee5\u00a0ServletWebServerFactoryAutoConfiguration \u4e3a\u4f8b\uff0c\u4ecb\u7ecd Spring Boot \u81ea\u52a8\u914d\u7f6e\u662f\u5982\u4f55\u751f\u6548\u7684\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">ServletWebServerFactoryAutoConfiguration\u00a0<\/h5>\n\n\n\n<p>ServletWebServerFactoryAutoConfiguration \u4ee3\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    @Configuration(   \/\/\u8868\u793a\u8fd9\u662f\u4e00\u4e2a\u914d\u7f6e\u7c7b\uff0c\u4e0e xml \u914d\u7f6e\u6587\u4ef6\u7b49\u4ef7\uff0c\u4e5f\u53ef\u4ee5\u7ed9\u5bb9\u5668\u4e2d\u6dfb\u52a0\u7ec4\u4ef6\n            proxyBeanMethods = false\n    )\n    @AutoConfigureOrder(-2147483648)\n    @ConditionalOnClass({ServletRequest.class})\/\/\u5224\u65ad\u5f53\u524d\u9879\u76ee\u6709\u6ca1\u6709 ServletRequest \u8fd9\u4e2a\u7c7b\n    @ConditionalOnWebApplication(\/\/ \u5224\u65ad\u5f53\u524d\u5e94\u7528\u662f\u5426\u662f web \u5e94\u7528\uff0c\u5982\u679c\u662f\uff0c\u5f53\u524d\u914d\u7f6e\u7c7b\u751f\u6548 \n    type = Type.SERVLET\n    )\n    @EnableConfigurationProperties({ServerProperties.class})\n    \/\/\u542f\u52a8\u6307\u5b9a\u7c7b\u7684\u5c5e\u6027\u914d\u7f6e\uff08ConfigurationProperties\uff09\u529f\u80fd\uff1b\u5c06\u914d\u7f6e\u6587\u4ef6\u4e2d\u5bf9\u5e94\u7684\u503c\u548c ServerProperties \u7ed1\u5b9a\u8d77\u6765\uff1b\u5e76\u628a ServerProperties \u52a0\u5165\u5230ioc\u5bb9\u5668\u4e2d\n    @Import({ServletWebServerFactoryAutoConfiguration.BeanPostProcessorsRegistrar.class, EmbeddedTomcat.class, EmbeddedJetty.class, EmbeddedUndertow.class})\n    public class ServletWebServerFactoryAutoConfiguration {\n        public ServletWebServerFactoryAutoConfiguration() {\n        }\n        @Bean \/\/\u7ed9\u5bb9\u5668\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u7ec4\u4ef6\uff0c\u8fd9\u4e2a\u7ec4\u4ef6\u7684\u67d0\u4e9b\u503c\u9700\u8981\u4eceproperties\u4e2d\u83b7\u53d6\n        public ServletWebServerFactoryCustomizer servletWebServerFactoryCustomizer(ServerProperties serverProperties, ObjectProvider&lt;WebListenerRegistrar> webListenerRegistrars) {\n            return new ServletWebServerFactoryCustomizer(serverProperties, (List) webListenerRegistrars.orderedStream().collect(Collectors.toList()));\n        }\n        @Bean\n        @ConditionalOnClass(\n                name = {\"org.apache.catalina.startup.Tomcat\"}\n        )\n        public TomcatServletWebServerFactoryCustomizer tomcatServletWebServerFactoryCustomizer(ServerProperties serverProperties) {\n            return new TomcatServletWebServerFactoryCustomizer(serverProperties);\n        }\n        @Bean\n        @ConditionalOnMissingFilterBean({ForwardedHeaderFilter.class})\n        @ConditionalOnProperty(\n                value = {\"server.forward-headers-strategy\"},\n                havingValue = \"framework\"\n        )\n        public FilterRegistrationBean&lt;ForwardedHeaderFilter> forwardedHeaderFilter() {\n            ForwardedHeaderFilter filter = new ForwardedHeaderFilter();\n            FilterRegistrationBean&lt;ForwardedHeaderFilter> registration = new FilterRegistrationBean(filter, new ServletRegistrationBean[0]);\n            registration.setDispatcherTypes(DispatcherType.REQUEST, new DispatcherType[]{DispatcherType.ASYNC, DispatcherType.ERROR});\n            registration.setOrder(-2147483648);\n            return registration;\n        }\n        public static class BeanPostProcessorsRegistrar implements ImportBeanDefinitionRegistrar, BeanFactoryAware {\n            private ConfigurableListableBeanFactory beanFactory;\n            public BeanPostProcessorsRegistrar() {\n            }\n            public void setBeanFactory(BeanFactory beanFactory) throws BeansException {\n                if (beanFactory instanceof ConfigurableListableBeanFactory) {\n                    this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;\n                }\n            }\n            public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {\n                if (this.beanFactory != null) {\n                    this.registerSyntheticBeanIfMissing(registry, \"webServerFactoryCustomizerBeanPostProcessor\", WebServerFactoryCustomizerBeanPostProcessor.class, WebServerFactoryCustomizerBeanPostProcessor::new);\n                    this.registerSyntheticBeanIfMissing(registry, \"errorPageRegistrarBeanPostProcessor\", ErrorPageRegistrarBeanPostProcessor.class, ErrorPageRegistrarBeanPostProcessor::new);\n                }\n            }\n            private &lt;T> void registerSyntheticBeanIfMissing(BeanDefinitionRegistry registry, String name, Class&lt;T> beanClass, Supplier&lt;T> instanceSupplier) {\n                if (ObjectUtils.isEmpty(this.beanFactory.getBeanNamesForType(beanClass, true, false))) {\n                    RootBeanDefinition beanDefinition = new RootBeanDefinition(beanClass, instanceSupplier);\n                    beanDefinition.setSynthetic(true);\n                    registry.registerBeanDefinition(name, beanDefinition);\n                }\n            }\n        }\n    }<\/pre>\n\n\n\n<p>\u8be5\u7c7b\u4f7f\u7528\u4e86\u4ee5\u4e0b\u6ce8\u89e3\uff1a<\/p>\n\n\n\n<ul><li>@Configuration\uff1a\u7528\u4e8e\u5b9a\u4e49\u4e00\u4e2a\u914d\u7f6e\u7c7b\uff0c\u53ef\u7528\u4e8e\u66ff\u6362 Spring \u4e2d\u7684 xml \u914d\u7f6e\u6587\u4ef6\uff1b<\/li><li>@Bean\uff1a\u88ab @Configuration \u6ce8\u89e3\u7684\u7c7b\u5185\u90e8\uff0c\u53ef\u4ee5\u5305\u542b\u6709\u4e00\u4e2a\u6216\u591a\u4e2a\u88ab @Bean \u6ce8\u89e3\u7684\u65b9\u6cd5\uff0c\u7528\u4e8e\u6784\u5efa\u4e00\u4e2a Bean\uff0c\u5e76\u6dfb\u52a0\u5230 Spring \u5bb9\u5668\u4e2d\uff1b\u8be5\u6ce8\u89e3\u4e0e spring \u914d\u7f6e\u6587\u4ef6\u4e2d&nbsp;&lt;bean&gt; \u7b49\u4ef7\uff0c\u65b9\u6cd5\u540d\u4e0e &lt;bean&gt; \u7684 id \u6216 name \u5c5e\u6027\u7b49\u4ef7\uff0c\u65b9\u6cd5\u8fd4\u56de\u503c\u4e0e class \u5c5e\u6027\u7b49\u4ef7\uff1b<\/li><\/ul>\n\n\n\n<p>\u9664\u4e86 @Configuration \u548c @Bean \u6ce8\u89e3\u5916\uff0c\u8be5\u7c7b\u8fd8\u4f7f\u7528 5 \u4e2a @Conditional \u884d\u751f\u6ce8\u89e3\uff1a<\/p>\n\n\n\n<ul><li>@ConditionalOnClass({ServletRequest.class})\uff1a\u5224\u65ad\u5f53\u524d\u9879\u76ee\u662f\u5426\u5b58\u5728&nbsp;ServletRequest \u8fd9\u4e2a\u7c7b\uff0c\u82e5\u5b58\u5728\uff0c\u5219\u8be5\u914d\u7f6e\u7c7b\u751f\u6548\u3002<\/li><li>@ConditionalOnWebApplication(type = Type.SERVLET)\uff1a\u5224\u65ad\u5f53\u524d\u5e94\u7528\u662f\u5426\u662f Web \u5e94\u7528\uff0c\u5982\u679c\u662f\u7684\u8bdd\uff0c\u5f53\u524d\u914d\u7f6e\u7c7b\u751f\u6548\u3002<\/li><li>@ConditionalOnClass(name = {&#8220;org.apache.catalina.startup.Tomcat&#8221;})\uff1a\u5224\u65ad\u662f\u5426\u5b58\u5728&nbsp;Tomcat \u7c7b\uff0c\u82e5\u5b58\u5728\u5219\u8be5\u65b9\u6cd5\u751f\u6548\u3002<\/li><li>@ConditionalOnMissingFilterBean({ForwardedHeaderFilter.class})\uff1a\u5224\u65ad\u5bb9\u5668\u4e2d\u662f\u5426\u6709&nbsp;ForwardedHeaderFilter \u8fd9\u4e2a\u8fc7\u6ee4\u5668\uff0c\u82e5\u4e0d\u5b58\u5728\u5219\u8be5\u65b9\u6cd5\u751f\u6548\u3002<\/li><li>@ConditionalOnProperty(value = {&#8220;server.forward-headers-strategy&#8221;},havingValue = &#8220;framework&#8221;)\uff1a\u5224\u65ad\u914d\u7f6e\u6587\u4ef6\u4e2d\u662f\u5426\u5b58\u5728&nbsp;server.forward-headers-strategy =&nbsp;framework\uff0c\u82e5\u4e0d\u5b58\u5728\u5219\u8be5\u65b9\u6cd5\u751f\u6548\u3002<\/li><\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">ServerProperties\u00a0<\/h5>\n\n\n\n<p>ServletWebServerFactoryAutoConfiguration \u7c7b\u8fd8\u4f7f\u7528\u4e86\u4e00\u4e2a @EnableConfigurationProperties \u6ce8\u89e3\uff0c\u901a\u8fc7\u8be5\u6ce8\u89e3\u5bfc\u5165\u4e86\u4e00\u4e2a ServerProperties \u7c7b\uff0c\u5176\u90e8\u5206\u6e90\u7801\u5982\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    @ConfigurationProperties(\n        prefix = \"server\",\n        ignoreUnknownFields = true\n    )\n    public class ServerProperties {\n        private Integer port;\n        private InetAddress address;\n        @NestedConfigurationProperty\n        private final ErrorProperties error = new ErrorProperties();\n        private ServerProperties.ForwardHeadersStrategy forwardHeadersStrategy;\n        private String serverHeader;\n        private DataSize maxHttpHeaderSize = DataSize.ofKilobytes(8L);\n        private Shutdown shutdown;\n        @NestedConfigurationProperty\n        private Ssl ssl;\n        @NestedConfigurationProperty\n        private final Compression compression;\n        @NestedConfigurationProperty\n        private final Http2 http2;\n        private final ServerProperties.Servlet servlet;\n        private final ServerProperties.Tomcat tomcat;\n        private final ServerProperties.Jetty jetty;\n        private final ServerProperties.Netty netty;\n        private final ServerProperties.Undertow undertow;\n        public ServerProperties() {\n            this.shutdown = Shutdown.IMMEDIATE;\n            this.compression = new Compression();\n            this.http2 = new Http2();\n            this.servlet = new ServerProperties.Servlet();\n            this.tomcat = new ServerProperties.Tomcat();\n            this.jetty = new ServerProperties.Jetty();\n            this.netty = new ServerProperties.Netty();\n            this.undertow = new ServerProperties.Undertow();\n        }\n        ....\n    }<\/pre>\n\n\n\n<p>\u6211\u4eec\u770b\u5230\uff0cServletWebServerFactoryAutoConfiguration \u4f7f\u7528\u4e86\u4e00\u4e2a\u00a0@EnableConfigurationProperties \u6ce8\u89e3\uff0c\u800c\u00a0ServerProperties \u7c7b\u4e0a\u5219\u4f7f\u7528\u4e86\u4e00\u4e2a @ConfigurationProperties \u6ce8\u89e3\u3002\u8fd9\u5176\u5b9e\u662f Spring Boot \u81ea\u52a8\u914d\u7f6e\u673a\u5236\u4e2d\u7684\u901a\u7528\u7528\u6cd5\u3002<br><br>Spring Boot \u4e2d\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u5927\u91cf\u7684\u81ea\u52a8\u914d\u7f6e\u7c7b XxxAutoConfiguration \u4ee5\u53ca XxxProperties\uff0c\u6bcf\u4e2a\u81ea\u52a8\u914d\u7f6e\u7c7b\u00a0XxxAutoConfiguration \u90fd\u4f7f\u7528\u4e86\u00a0@EnableConfigurationProperties \u6ce8\u89e3\uff0c\u800c\u6bcf\u4e2a\u00a0XxxProperties \u4e0a\u90fd\u4f7f\u7528 @ConfigurationProperties \u6ce8\u89e3\u3002<br><br>@ConfigurationProperties \u6ce8\u89e3\u7684\u4f5c\u7528\uff0c\u662f\u5c06\u8fd9\u4e2a\u7c7b\u7684\u6240\u6709\u5c5e\u6027\u4e0e\u914d\u7f6e\u6587\u4ef6\u4e2d\u76f8\u5173\u7684\u914d\u7f6e\u8fdb\u884c\u7ed1\u5b9a\uff0c\u4ee5\u4fbf\u4e8e\u83b7\u53d6\u6216\u4fee\u6539\u914d\u7f6e\uff0c\u4f46\u662f @ConfigurationProperties \u529f\u80fd\u662f\u7531\u5bb9\u5668\u63d0\u4f9b\u7684\uff0c\u88ab\u5b83\u6ce8\u89e3\u7684\u7c7b\u5fc5\u987b\u662f\u5bb9\u5668\u4e2d\u7684\u4e00\u4e2a\u7ec4\u4ef6\uff0c\u5426\u5219\u8be5\u529f\u80fd\u5c31\u65e0\u6cd5\u4f7f\u7528\u3002\u800c @EnableConfigurationProperties \u6ce8\u89e3\u7684\u4f5c\u7528\u6b63\u662f\u5c06\u6307\u5b9a\u7684\u7c7b\u4ee5\u7ec4\u4ef6\u7684\u5f62\u5f0f\u6ce8\u5165\u5230 IOC \u5bb9\u5668\u4e2d\uff0c\u5e76\u5f00\u542f\u5176 @ConfigurationProperties \u529f\u80fd\u3002\u56e0\u6b64\uff0c@ConfigurationProperties +\u00a0@EnableConfigurationProperties \u7ec4\u5408\u4f7f\u7528\uff0c\u4fbf\u53ef\u4ee5\u4e3a XxxProperties \u7c7b\u5b9e\u73b0\u914d\u7f6e\u7ed1\u5b9a\u529f\u80fd\u3002<br><br>\u81ea\u52a8\u914d\u7f6e\u7c7b XxxAutoConfiguration \u8d1f\u8d23\u4f7f\u7528\u00a0XxxProperties \u4e2d\u5c5e\u6027\u8fdb\u884c\u81ea\u52a8\u914d\u7f6e\uff0c\u800c\u00a0XxxProperties \u5219\u8d1f\u8d23\u5c06\u81ea\u52a8\u914d\u7f6e\u5c5e\u6027\u4e0e\u914d\u7f6e\u6587\u4ef6\u7684\u76f8\u5173\u914d\u7f6e\u8fdb\u884c\u7ed1\u5b9a\uff0c\u4ee5\u4fbf\u4e8e\u7528\u6237\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u4fee\u6539\u9ed8\u8ba4\u7684\u81ea\u52a8\u914d\u7f6e\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u771f\u6b63\u201c\u9650\u5236\u201d\u6211\u4eec\u53ef\u4ee5\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u914d\u7f6e\u54ea\u4e9b\u5c5e\u6027\u7684\u7c7b\u5c31\u662f\u8fd9\u4e9b XxxxProperties \u7c7b\uff0c\u5b83\u4e0e\u914d\u7f6e\u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684 prefix \u5173\u952e\u5b57\u5f00\u5934\u7684\u4e00\u7ec4\u5c5e\u6027\u662f\u552f\u4e00\u5bf9\u5e94\u7684\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\u6ce8\u610f\uff1aXxxAutoConfiguration \u4e0e&nbsp;XxxProperties \u5e76\u4e0d\u662f\u4e00\u4e00\u5bf9\u5e94\u7684\uff0c\u5927\u591a\u6570\u60c5\u51b5\u90fd\u662f\u591a\u5bf9\u591a\u7684\u5173\u7cfb\uff0c\u5373\u4e00\u4e2a&nbsp;XxxAutoConfiguration \u53ef\u4ee5\u540c\u65f6\u4f7f\u7528\u591a\u4e2a&nbsp;XxxProperties \u4e2d\u7684\u5c5e\u6027\uff0c\u4e00\u4e2a&nbsp;XxxProperties \u7c7b\u4e2d\u5c5e\u6027\u4e5f\u53ef\u4ee5\u88ab\u591a\u4e2a&nbsp;XxxAutoConfiguration \u4f7f\u7528\u3002<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u4eec\u77e5\u9053\uff0cSpring Boot \u9879\u76ee\u521b\u5efa\u5b8c\u6210\u540e\uff0c\u5373\u4f7f\u4e0d\u8fdb\u884c\u4efb\u4f55\u7684\u914d\u7f6e\uff0c\u4e5f\u80fd\u591f\u987a\u5229\u5730\u8fd0\u884c\uff0c\u8fd9\u90fd\u8981\u5f52\u529f\u4e8e Spr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/4385"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4385"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/4385\/revisions"}],"predecessor-version":[{"id":4394,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/4385\/revisions\/4394"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}