类 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
  • 构造器详细资料

  • 方法详细资料

    • discover

      public void discover(List<String> service)
      处理注册中心的服务(通过解析路由配置)
      参数:
      service - 服务列表集合
    • getResources

      public List<OpenAPI2Resource> getResources(String forwardPath)
      获取所有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

      public void add(OpenAPI2Resource resource)
      添加分组资源
      参数:
      resource - 资源
      从以下版本开始:
      v4.3.0
    • remove

      public void remove(String serviceName)
      根据服务名称下线,作用于discover模式下
      参数:
      serviceName - 服务名称
      从以下版本开始:
      v4.3.0