Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-cloud-core
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
xingmin
yd-cloud-core
Commits
12e6811f
Commit
12e6811f
authored
Sep 08, 2025
by
jianan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
knife4j2
parent
bb65fa15
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
yd-gateway/src/main/java/com/yd/gateway/config/Knife4jExcludeService.java
+29
-0
No files found.
yd-gateway/src/main/java/com/yd/gateway/config/Knife4jExcludeService.java
0 → 100644
View file @
12e6811f
package
com
.
yd
.
gateway
.
config
;
import
com.github.xiaoymin.knife4j.spring.gateway.Knife4jGatewayProperties
;
import
com.github.xiaoymin.knife4j.spring.gateway.discover.spi.GatewayServiceExcludeService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.TreeSet
;
import
java.util.stream.Collectors
;
@Slf4j
@Component
public
class
Knife4jExcludeService
implements
GatewayServiceExcludeService
{
@Override
public
Set
<
String
>
exclude
(
Environment
environment
,
Knife4jGatewayProperties
properties
,
List
<
String
>
services
)
{
log
.
info
(
"自定义过滤器."
);
if
(!
CollectionUtils
.
isEmpty
(
services
)){
// 排除注册中心包含 auth字眼的服务
return
services
.
stream
()
.
filter
(
s
->
s
.
contains
(
"auth"
)
||
s
.
contains
(
"oss"
))
.
collect
(
Collectors
.
toSet
());
}
return
new
TreeSet
<>();
}
}
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