Commit b9822f1e7a1c5fdd795f546350ccf247f824ed27
1 parent
d797e6d7
微服务模式部署下,nacos的账户密码如果不使用默认提供的nacos/nacos,会导致gateway读取路由信息失败 #2375
Showing
3 changed files
with
24 additions
and
6 deletions
README.md
... | ... | @@ -73,7 +73,7 @@ Jeecg-Boot低代码开发平台,可以应用在任何J2EE项目的开发中, |
73 | 73 | 为什么选择JEECG-BOOT? |
74 | 74 | ----------------------------------- |
75 | 75 | * 1.采用最新主流前后分离框架(Springboot+Mybatis+antd),容易上手; 代码生成器依赖性低,灵活的扩展能力,可快速实现二次开发; |
76 | -* 2.支持微服务SpringCloud Alibaba(Nacos、Gateway、Sentinel、Skywarking),提供切换机制支持单体和微服务自由切换 | |
76 | +* 2.支持微服务SpringCloud Alibaba(Nacos、Gateway、Sentinel、Skywalking),提供切换机制支持单体和微服务自由切换 | |
77 | 77 | * 3.开发效率高,采用代码生成器,单表、树列表、一对多、一对一等数据模型,增删改查功能一键生成,菜单配置直接使用; |
78 | 78 | * 4.代码生成器提供强大模板机制,支持自定义模板,目前提供四套风格模板(单表两套、树模型一套、一对多三套) |
79 | 79 | * 5.代码生成器非常智能,在线业务建模、在线配置、所见即所得支持23种类控件,一键生成前后端代码,大幅度提升开发效率,不再为重复工作发愁。 |
... | ... | @@ -143,7 +143,7 @@ Jeecg-Boot低代码开发平台,可以应用在任何J2EE项目的开发中, |
143 | 143 | |
144 | 144 | - 安全框架:Apache Shiro 1.7.0,Jwt 3.11.0 |
145 | 145 | |
146 | -- 微服务技术栈:Spring Cloud Alibaba、Nacos、Gateway、Sentinel、Skywarking | |
146 | +- 微服务技术栈:Spring Cloud Alibaba、Nacos、Gateway、Sentinel、Skywalking | |
147 | 147 | |
148 | 148 | - 数据库连接池:阿里巴巴Druid 1.1.22 |
149 | 149 | |
... | ... | @@ -328,7 +328,7 @@ Jeecg-Boot低代码开发平台,可以应用在任何J2EE项目的开发中, |
328 | 328 | |
329 | 329 | 8、服务监控 SpringBootAdmin√ |
330 | 330 | |
331 | -9、链路跟踪 Skywarking [参考文档](https://www.kancloud.cn/zhangdaiscott/jeecgcloud/1771670) | |
331 | +9、链路跟踪 Skywalking [参考文档](https://www.kancloud.cn/zhangdaiscott/jeecgcloud/1771670) | |
332 | 332 | |
333 | 333 | 10、消息中间件 RabbitMQ √ |
334 | 334 | |
... | ... | @@ -336,7 +336,7 @@ Jeecg-Boot低代码开发平台,可以应用在任何J2EE项目的开发中, |
336 | 336 | |
337 | 337 | 12、分布式事务 Seata |
338 | 338 | |
339 | -13、分布式日志 elk + kafa | |
339 | +13、分布式日志 elk + kafka | |
340 | 340 | |
341 | 341 | 14、支持 docker-compose、k8s、jenkins |
342 | 342 | |
... | ... |
jeecg-boot/jeecg-cloud-module/jeecg-cloud-gateway/src/main/java/org/jeecg/config/GatewayRoutersConfiguration.java
... | ... | @@ -37,6 +37,10 @@ public class GatewayRoutersConfiguration { |
37 | 37 | |
38 | 38 | public static String ROUTE_GROUP; |
39 | 39 | |
40 | + public static String USERNAME; | |
41 | + | |
42 | + public static String PASSWORD; | |
43 | + | |
40 | 44 | /** |
41 | 45 | * 路由配置文件数据获取方式yml,nacos,database |
42 | 46 | */ |
... | ... | @@ -63,8 +67,15 @@ public class GatewayRoutersConfiguration { |
63 | 67 | } |
64 | 68 | |
65 | 69 | @Value("${jeecg.route.config.data-type}") |
66 | - public void setDataType(String dataType) { | |
67 | - DATA_TYPE = dataType; | |
70 | + public void setDataType(String dataType) { DATA_TYPE = dataType; } | |
71 | + | |
72 | + @Value("${spring.cloud.nacos.config.username}") | |
73 | + public void setUsername(String username) { | |
74 | + USERNAME = username; | |
75 | + } | |
76 | + @Value("${spring.cloud.nacos.config.password}") | |
77 | + public void setPassword(String password) { | |
78 | + PASSWORD = password; | |
68 | 79 | } |
69 | 80 | |
70 | 81 | |
... | ... | @@ -79,6 +90,11 @@ public class GatewayRoutersConfiguration { |
79 | 90 | |
80 | 91 | } |
81 | 92 | |
93 | + /** | |
94 | + * 映射接口文档默认地址(通过9999端口直接访问) | |
95 | + * @param indexHtml | |
96 | + * @return | |
97 | + */ | |
82 | 98 | @Bean |
83 | 99 | public RouterFunction<ServerResponse> indexRouter(@Value("classpath:/META-INF/resources/doc.html") final org.springframework.core.io.Resource indexHtml) { |
84 | 100 | return route(GET("/"), request -> ok().contentType(MediaType.TEXT_HTML).syncBody(indexHtml)); |
... | ... |
jeecg-boot/jeecg-cloud-module/jeecg-cloud-gateway/src/main/java/org/jeecg/loader/DynamicRouteLoader.java
... | ... | @@ -299,6 +299,8 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware { |
299 | 299 | Properties properties = new Properties(); |
300 | 300 | properties.setProperty("serverAddr", GatewayRoutersConfiguration.SERVER_ADDR); |
301 | 301 | properties.setProperty("namespace", GatewayRoutersConfiguration.NAMESPACE); |
302 | + properties.setProperty("username",GatewayRoutersConfiguration.USERNAME); | |
303 | + properties.setProperty("password",GatewayRoutersConfiguration.PASSWORD); | |
302 | 304 | return configService = NacosFactory.createConfigService(properties); |
303 | 305 | } catch (Exception e) { |
304 | 306 | log.error("创建ConfigService异常", e); |
... | ... |