# springboot-integrate **Repository Path**: wings-gocoo/springboot-integrate ## Basic Information - **Project Name**: springboot-integrate - **Description**: be used to record daily study conclusion - **Primary Language**: Java - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2021-06-10 - **Last Updated**: 2022-06-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # springboot-integrate #### 介绍 be used to record daily study conclusion #### 软件架构 Springboot + SpringCloud #### 使用说明(注意事项) 1. 整合SpringCloud时需注意与Springboot版本进行兼容 版本兼容对应关系参考nacos官网文档 2. Springboot项目将nacos作为服务注册中心和配置中心需将配置信息写在bootstrap.yml中,这样做的原因是 为了遵循Springboot框架读取配置文件顺序,若不执行读取顺序将无法读取配置信息,导致集成SpringCloud失败 配置文件优先级(由高到低): bootstrap.properties -> bootstrap.yml -> application.properties -> application.yml 3. 项目采用了maven父子模块设计,新建模块时需在父模块pom文件声明子模块,模块之间相互引用也需在所属的pom文件中声明 4. SpringCloudAlibaba中的nacos组件自带集成了ribbon负载均衡功能,因此在某一个服务多端口运行时,调用服务的时候会根据均衡策略进行匹配; 至于负载均衡策略可在项目中自定义配置,也可以在nacos可视化界面进行配置权重,不过一般在不清楚各服务器的性能时可以使用nacos默认负载均衡策略 5. 集成网关Gateway组件时,需要注意引入gateway依赖时排除spring-boot-starter-web依赖,否则会导致项目运行失败,这么做的原因是spring cloud gateway是基于webflux的, 如果非要web支持的话需要导入spring-boot-starter-webflux而不是spring-boot-start-web 6. sentinel控制台执行命令: java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar 默认用户名和密码均为sentinel 7. 集成sentinel依赖时需注意springboot和springcloud的版本信息 否则会导致运行报错 (eg:原先项目采用的是2.0.5.RELEASE和Finchley.SR1导致启动失败,后改成2.2.5.RELEASE和Hoxton.SR3启动成功) 8. ElasticHD启动命令: ElasticHD -p 127.0.0.1:9800 9. RocketMq服务与控制台启动: 1.启动 NAMESERVER start mqnamesrv.cmd 2.启动BROKER start mqbroker.cmd -n 127.0.0.1:9876 autoCreateTopicEnable=true 3.rocketmq插件部署启动 Java -jar xxxxx.jar