长沙网站seo公司,net framework可以用来做网站吗,内容聚合网站开发教程,vip视频解析网站怎么做spring 版本以及相关的组件一直在变化#xff0c;其中一些类或者功能在低版本中有#xff0c;高版本中去掉了#xff0c;有的新功能只在高版本有。
为了防止理解问题#xff0c;pom.xml 版本依赖如下
parentgroupIdorg.springframework.boot/groupId…
spring 版本以及相关的组件一直在变化其中一些类或者功能在低版本中有高版本中去掉了有的新功能只在高版本有。
为了防止理解问题pom.xml 版本依赖如下
parentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.3.12.RELEASE/versionrelativePath/ !-- lookup parent from repository --
/parentdependencyManagementdependenciesdependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-dependencies/artifactIdversionHoxton.SR12/versiontypepom/typescopeimport/scope/dependencydependencygroupIdcom.alibaba.cloud/groupIdartifactIdspring-cloud-alibaba-dependencies/artifactIdversion2.2.6.RELEASE/versiontypepom/typescopeimport/scope/dependency/dependencies
/dependencyManagement
日常开发中经常使用的配置文件有 application 和 bootstrap日志相关的例外不做讲解对应的配置文件后缀分别为 properties 或者 ymlyaml区别如下 application
属于 spring boot。
简单使用不依赖其他服务spring boot 的依赖足够。 bootstrap
属于 spring cloud位于 spring-cloud-context 中。
dependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-context/artifactIdversion3.0.0/version
/dependency
可以看到在 spring.factories 中声明了 ApplicationListener 的实现类 BootstrapApplicationListener所以开源组件如果想要使用 spring cloud 的组件一般都会引入这个。 想要读取对应的配置需要结合 BootstrapApplicationListener 进行读取。
如果未引入 spring-cloud-context 相关依赖bootstrap 相关配置文件则无法找到。
idea 对应的文件图标颜色发生改变 引入了依赖 未引入依赖 其中对应的配置加载都通过 ConfigFileApplicationListener 来处理。
github 上源码如下 https://github.com/spring-projects/spring-boot/blob/v2.3.12.RELEASE/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/package-info.java https://github.com/spring-projects/spring-boot/blob/v2.3.12.RELEASE/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java 可以发现ConfigFileApplicationListener 位于 spring boot 中。 从 spring cloud 2020.0.x 版本开始针对 bootstrap 的处理发生改变由于 spring cloud 2020.0.x 对应的 spring boot 版本为 2.4.x所以需要做对应的升级处理。