
一、父模块1、Spring Cloud alibabadependency groupIdcom.alibaba.cloud/groupId artifactIdspring-cloud-alibaba-dependencies/artifactId version2025.0.0.0/version typepom/type scopeimport/scope /dependency dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-dependencies/artifactId version2025.0.0/version typepom/type scopeimport/scope /dependency2、SpringBootdependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-parent/artifactId version3.5.5/version typepom/type scopeimport/scope /dependency3、swagger这是SpringBoot3 Knife4j 增强swagger UI不用再引入springfox-swagger-ui引入了会冲突。dependency groupIdcom.github.xiaoymin/groupId artifactIdknife4j-openapi3-jakarta-spring-boot-starter/artifactId version4.5.0/version /dependency4、数据库连接池dependency groupIdcom.alibaba/groupId artifactIddruid-spring-boot-starter/artifactId version1.2.20/version /dependency5、sentineldependency groupIdcom.alibaba.cloud/groupId artifactIdspring-cloud-starter-alibaba-sentinel/artifactId version2025.0.0.0/version /dependency !--sentinel nacos 配置持久化 这个只需要子模块引入 父模块不引入-- dependency groupIdcom.alibaba.csp/groupId artifactIdsentinel-datasource-nacos/artifactId /dependency6、数据库这个驱动的版本不等同于mysql的版本8版本的就可以兼容mysql的8版本dependency groupIdcom.mysql/groupId artifactIdmysql-connector-j/artifactId version8.0.33/version /dependency7、mybatis-plus这个一定要用boot3-start 且为3.5.x的版本dependency groupIdcom.baomidou/groupId artifactIdmybatis-plus-spring-boot3-starter/artifactId version3.5.12/version /dependency8、通用的依赖(根据需要添加)!--minio的版本管理-- dependency groupIdio.minio/groupId artifactIdminio/artifactId version8.5.6/version /dependency !--influxdb的版本管理-- dependency groupIdcom.influxdb/groupId artifactIdinfluxdb3-java/artifactId version1.10.0/version /dependency !--xxl-job的版本管理-- dependency groupIdcom.xuxueli/groupId artifactIdxxl-job-core/artifactId version3.4.2/version /dependency dependency groupIdorg.projectlombok/groupId artifactIdlombok/artifactId version1.18.30/version /dependency dependency groupIdcn.hutool/groupId artifactIdhutool-all/artifactId version5.8.22/version /dependency dependency groupIdcom.alibaba/groupId artifactIdeasyexcel/artifactId version3.3.2/version /dependency dependency groupIdcom.fasterxml.jackson.core/groupId artifactIdjackson-annotations/artifactId version2.19.2/version /dependency二、子模块远程RPC调用注意事项1、依赖引入若子模块需要用openfeign rpc远程调用相关的东西则直接在子模块中引入。!-- RPC 远程调用相关 -- dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-starter-openfeign/artifactId optionaltrue/optional /dependency dependency groupIdorg.springframework.cloud/groupId artifactIdspring-cloud-starter-loadbalancer/artifactId /dependency因为父 pom 已经导入了 Spring Cloud 统一依赖管理即一、1不需要单独写 openfeign 版本。而且一定要引入loadbalancer因为新版本彻底移除了 RibbonFeign 底层默认依赖 Spring Cloud LoadBalancer 做服务实例负载均衡调用远程接口时会报错java.lang.IllegalStateException: No LoadBalancer found for service: xxx-service2、scanBasePackages如下图所示一定要写SpringBootApplication(scanBasePackages {com.cloud.zhenyu}) 这个注解。scanBasePackages指定 Spring 自动扫描包范围默认不写这个的话只扫描当前启动类所在包 所有子包而被调用的api接口不在启动类模块的子包下所以一定会报错。而api所在模块与调用者所在模块的包名前缀都一样的所以这里直接写的com.cloud.zhenyu。Field influxApi in com.cloud.zhenyu.controller.xxxController required a bean of type com.cloud.zhenyu.api.InfluxApi that could not be found. The injection point has the following annotations: - org.springframework.beans.factory.annotation.Autowired(requiredtrue) Action: Consider defining a bean of type com.cloud.zhenyu.api.InfluxApi in your configuration.3、EnableFeignClients作用Spring 默认不会识别FeignClient接口加上这个注解后Spring 启动时会扫描指定包下所有标记FeignClient的 RPC 接口动态生成代理实现类注入 Spring 容器成为 Bean供你Autowired注入调用。搭配 scanBasePackages /basePackages 跨模块扫描。