Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jeecg-boot
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
jeecg-boot
Commits
766c48bd
Commit
766c48bd
authored
Feb 20, 2021
by
zhangdaiscott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feign 动态创建client,拦截器执行多次 #2275
parent
d16520cc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-cloud/src/main/java/org/jeecg/starter/cloud/feign/impl/JeecgFeignService.java
+6
-4
No files found.
jeecg-boot/jeecg-boot-starter/jeecg-boot-starter-cloud/src/main/java/org/jeecg/starter/cloud/feign/impl/JeecgFeignService.java
View file @
766c48bd
...
@@ -35,11 +35,7 @@ public class JeecgFeignService implements IJeecgFeignService {
...
@@ -35,11 +35,7 @@ public class JeecgFeignService implements IJeecgFeignService {
.
encoder
(
encoder
)
.
encoder
(
encoder
)
.
decoder
(
decoder
)
.
decoder
(
decoder
)
.
contract
(
contract
);
.
contract
(
contract
);
}
@Override
public
<
T
>
T
newInstance
(
Class
<
T
>
clientClass
,
String
serviceName
)
{
builder
.
requestInterceptor
(
requestTemplate
->
{
builder
.
requestInterceptor
(
requestTemplate
->
{
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
null
!=
attributes
)
{
if
(
null
!=
attributes
)
{
...
@@ -54,6 +50,11 @@ public class JeecgFeignService implements IJeecgFeignService {
...
@@ -54,6 +50,11 @@ public class JeecgFeignService implements IJeecgFeignService {
requestTemplate
.
header
(
CommonConstant
.
X_ACCESS_TOKEN
,
token
);
requestTemplate
.
header
(
CommonConstant
.
X_ACCESS_TOKEN
,
token
);
}
}
});
});
}
@Override
public
<
T
>
T
newInstance
(
Class
<
T
>
clientClass
,
String
serviceName
)
{
return
builder
.
target
(
clientClass
,
String
.
format
(
"http://%s/"
,
serviceName
));
return
builder
.
target
(
clientClass
,
String
.
format
(
"http://%s/"
,
serviceName
));
}
}
}
}
\ No newline at end of file
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