类 ServiceDiscoverHandler
java.lang.Object
com.github.xiaoymin.knife4j.spring.gateway.discover.ServiceDiscoverHandler
- 所有已实现的接口:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.EnvironmentAware
public class ServiceDiscoverHandler
extends Object
implements org.springframework.context.EnvironmentAware, org.springframework.context.ApplicationContextAware
- 从以下版本开始:
- knife4j v4.1.0
- 作者:
- xiaoymin@foxmail.com 2023/3/17 22:59
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidadd(OpenAPI2Resource resource) 添加分组资源void处理注册中心的服务(通过解析路由配置)getResources(String forwardPath) 获取所有OpenAPI资源列表void根据服务名称下线,作用于discover模式下voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetEnvironment(org.springframework.core.env.Environment environment)
-
构造器详细资料
-
ServiceDiscoverHandler
-
-
方法详细资料
-
discover
处理注册中心的服务(通过解析路由配置)- 参数:
service- 服务列表集合
-
getResources
获取所有OpenAPI资源列表- 参数:
forwardPath- 请求前缀contextPath路径,一般出现在Nginx代理的情况- 返回:
- 资源列表
-
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) - 指定者:
setEnvironment在接口中org.springframework.context.EnvironmentAware
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - 指定者:
setApplicationContext在接口中org.springframework.context.ApplicationContextAware- 抛出:
org.springframework.beans.BeansException
-
add
添加分组资源- 参数:
resource- 资源- 从以下版本开始:
- v4.3.0
-
remove
根据服务名称下线,作用于discover模式下- 参数:
serviceName- 服务名称- 从以下版本开始:
- v4.3.0
-