Spring Boot application starters
spring-boot-starter-web
spring-boot-starter-thymeleaf
spring-boot-starter-data-redis
spring-boot-starter-data-jpa
spring-boot-starter-data-elasticsearch
spring-boot-starter-data-mongodb
spring-boot-starter-test
spring-boot-starter-jdbc
spring-boot-starter-aop
spring-boot-starter-security
spring-boot-starter-actuator
spring-boot-starter-tomcat
这些都是常用的,当然还有一些其他的starter ,兄弟们可以自行查查!
自动化配置原理
在springboot的启动类中有@EnableAutoConfigration这个注解 在这个注解里边有一个注解叫import 通过它导入了EnableAutoConfigurationImportSelector类 这个选择器用来导入一些组件,在父类AutoConfigurationImportSelector里有一个selectImports方法,这个方法里有一个configurations,这个configurations会被返回,在方法里调用了getCandidateConfigurations方法,这个方法返回的就是之前的configurations,而这个方法里又调用了SpringFactoriesLoader下的loadFactoryNames方法,loadFactoryNames方法会扫描META-INF/spring.factories文件,这个文件就在springboot的autoconfiguration包下
Ribbon 和 Feign 的区别
Ribbon基于http和tcp的客户端负载均衡工具,通过restTemplate模拟http请求 步骤相当繁琐
Feign在ribbon的基础上进行过改进,使用起来更加方便 并且他默认集成了ribbon的负载均衡机制
至于 ribbon和Feign的调用方式 之前的博客分别做过详细解释 就不赘述啦!!
springcloudconfig 配置教程