Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
property-management
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
property-management
Commits
a674340c
Commit
a674340c
authored
Mar 28, 2021
by
zhangdaiscott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微服务模式部署下,nacos的账户密码如果不使用默认提供的nacos/nacos,会导致gateway读取路由信息失败 #2375
parent
cbd8890c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
jeecg-boot/jeecg-cloud-module/jeecg-cloud-gateway/src/main/java/org/jeecg/config/GatewayRoutersConfiguration.java
+18
-2
jeecg-boot/jeecg-cloud-module/jeecg-cloud-gateway/src/main/java/org/jeecg/loader/DynamicRouteLoader.java
+2
-0
No files found.
jeecg-boot/jeecg-cloud-module/jeecg-cloud-gateway/src/main/java/org/jeecg/config/GatewayRoutersConfiguration.java
View file @
a674340c
...
...
@@ -37,6 +37,10 @@ public class GatewayRoutersConfiguration {
public
static
String
ROUTE_GROUP
;
public
static
String
USERNAME
;
public
static
String
PASSWORD
;
/**
* 路由配置文件数据获取方式yml,nacos,database
*/
...
...
@@ -63,8 +67,15 @@ public class GatewayRoutersConfiguration {
}
@Value
(
"${jeecg.route.config.data-type}"
)
public
void
setDataType
(
String
dataType
)
{
DATA_TYPE
=
dataType
;
public
void
setDataType
(
String
dataType
)
{
DATA_TYPE
=
dataType
;
}
@Value
(
"${spring.cloud.nacos.config.username}"
)
public
void
setUsername
(
String
username
)
{
USERNAME
=
username
;
}
@Value
(
"${spring.cloud.nacos.config.password}"
)
public
void
setPassword
(
String
password
)
{
PASSWORD
=
password
;
}
...
...
@@ -79,6 +90,11 @@ public class GatewayRoutersConfiguration {
}
/**
* 映射接口文档默认地址(通过9999端口直接访问)
* @param indexHtml
* @return
*/
@Bean
public
RouterFunction
<
ServerResponse
>
indexRouter
(
@Value
(
"classpath:/META-INF/resources/doc.html"
)
final
org
.
springframework
.
core
.
io
.
Resource
indexHtml
)
{
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
View file @
a674340c
...
...
@@ -299,6 +299,8 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
"serverAddr"
,
GatewayRoutersConfiguration
.
SERVER_ADDR
);
properties
.
setProperty
(
"namespace"
,
GatewayRoutersConfiguration
.
NAMESPACE
);
properties
.
setProperty
(
"username"
,
GatewayRoutersConfiguration
.
USERNAME
);
properties
.
setProperty
(
"password"
,
GatewayRoutersConfiguration
.
PASSWORD
);
return
configService
=
NacosFactory
.
createConfigService
(
properties
);
}
catch
(
Exception
e
)
{
log
.
error
(
"创建ConfigService异常"
,
e
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment