{"id":48680711,"url":"https://github.com/taofen8/kong-client","last_synced_at":"2026-04-26T20:00:41.807Z","repository":{"id":45528668,"uuid":"257832038","full_name":"taofen8/kong-client","owner":"taofen8","description":"fast integrate spring projects to kong api gateway","archived":false,"fork":false,"pushed_at":"2022-12-16T02:28:24.000Z","size":119,"stargazers_count":53,"open_issues_count":5,"forks_count":13,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-07-13T22:47:03.143Z","etag":null,"topics":["gateway","java","kong","kong-client","microservices","sdk-java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taofen8.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-22T07:59:59.000Z","updated_at":"2025-03-20T02:39:04.000Z","dependencies_parsed_at":"2022-09-26T21:51:25.465Z","dependency_job_id":null,"html_url":"https://github.com/taofen8/kong-client","commit_stats":null,"previous_names":["hnotyet/kong-client"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/taofen8/kong-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taofen8%2Fkong-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taofen8%2Fkong-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taofen8%2Fkong-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taofen8%2Fkong-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taofen8","download_url":"https://codeload.github.com/taofen8/kong-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taofen8%2Fkong-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32310804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T19:15:34.056Z","status":"ssl_error","status_checked_at":"2026-04-26T19:15:15.467Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gateway","java","kong","kong-client","microservices","sdk-java"],"created_at":"2026-04-11T01:00:36.055Z","updated_at":"2026-04-26T20:00:41.800Z","avatar_url":"https://github.com/taofen8.png","language":"Java","funding_links":[],"categories":["API网关"],"sub_categories":["Spring Cloud框架"],"readme":"\u003cp align=\"right\"\u003eEN | \u003ca href=\"README.zh.md\"\u003e中文\u003c/a\u003e \u003c/p\u003e\n\n# Kong-client - A light weight java sdk  for fast integrating with kong \n\n![](https://img.shields.io/badge/license-Apache%202.0-blue)\n\nkong-client is a java sdk for kong ,which is a high performance and extensible microservice\nAPI gateway\n# Prerequsites\n- Spring 3.2.5+\n- JDK 1.7+\n- Kong 2.0.1+\n\n# Features\n- Fast Integration with springMVC:Suitable for all spring web app and work with less config\n- Mutiple strategies for service proxy\n- Register services automatically\n- Service Call API：Generic API for firing request\n- Load balancer\n- Built-in Monitor: sdk version, server status and metrics etc.\n\n# Terminology\n### Proxy strategy\n- #### kongmapping\n\n   By this strategy, kong-client will scan all services those annotationed by `KongServiceMapping`,and register them to kong server.\n   Note that, these services must be designed to  single paramter for request and response，and the parameter must be a java type instance which can be formatted to JSON. An possible service would be like this：\n   ```\n    @KongServiceMapping(path = \"/sayHello\")\n    HelloResponse sayHello(HelloRequest request){\n        \n    }   \n  ```\n    \n- #### springmapping\n \n  This strategy is very suitable for existing springMVC projects which are wanted to be integrated to kong,and use spring's `RequestMapping` annotation on every service.\n  The strategy will take advantage of all spring features,like intercepters,view resolvers,and complex request handlers etc. kong-client will only be  acted as a request proxy and do nothing invasive in request process.\n\n\n\n# Usage\n### Config\n#### server-side\n```\n# kong admin url, required\n# example: http://192.168.0.1:8001\nkong.config.server.admin.url\n\n# unique id for app, required \nkong.config.server.app.identifier\n\n# hosts can be accessed for services in this app, optional       \nkong.config.server.route.hosts\n\n# proxy strategy, required        \n# value: kongmapping / springmapping\nkong.config.server.proxy.strategy\n\n# healthcheck config, required                           \nkong.config.server.healthcheck.config\n\n# auto resolve ip from net interfaces ,default :on\nkong.config.server.address.resolve\n```\n\nThese config items would be specified if current app want to provide services to kong.\n\nNote that，if a dispatcher were customered in spring context,\nthe config `kong.config.server.proxy.strategy` will be ignored.\n\n#### client-side\n\n```\n# kong nodes for load balancer, required\n# format : single node :192.168.0.1:8000 , multiple nodes: 192.168.0.1:8000 w:200,192.168.0.2:8000 w:100\nkong.config.caller.balancer.nodes\n\n# switch of key-auth plugin\n# value: on /off , defualt: off\nkong.config.caller.keyauth.enable\n\n# keyname of key-auth plugin if the plugin enabled, \n# default: apikey\nkong.config.caller.keyauth.keyname\n\n```\n\nThese config items would be specifed if current app will  call kong's services.\nNote that, if the app is only be a consumer of services but not a provider when `kong.config.caller.keyauth.enable` is enabled,  `kong.config.server.admin.url` and `kong.config.server.app.identifier\n` also must be specified in order to register consumers automatically\n\n\n\n\n\n### Development\n* import maven dependency\n    ```\n    \u003cdependency\u003e\n      \u003cgroupId\u003ecom.taofen8.mid\u003c/groupId\u003e\n      \u003cartifactId\u003ekong-client\u003c/artifactId\u003e\n      \u003cversion\u003e0.2.2-RELEASE\u003c/version\u003e\n    \u003c/dependency\u003e\n    ```\n  \n* setup servlet\n \n    -  Springboot App \n \n       Customize a class to extends `com.taofen8.mid.kong.KongDispatcherServlet`\n        ```$xslt\n        @WebServlet(urlPatterns = \"/*\", loadOnStartup = 1)\n        public class KongProxyDispatcherServlet extends KongDispatcherServlet {\n        \n        }\n        ```\n        and，add annotation `@ServletComponentScan` to app entrypoint class:\n        ```\n          @ServletComponentScan\n          @SpringBootApplication\n          public class KongTestApplication {\n\n              public static void main(String[] args) {\n                  SpringApplication.run(KongTestApplication.class, args);\n              }\n          }\n        ```\n\n    - SpringMVC App\n      \n      Modify `web.xml`, change `org.springframework.web.servlet.DispatcherServlet` to `com.taofen8.mid.kong.KongDispatcherServlet`:\n      ```$xslt\n       \u003cservlet\u003e\n           \u003cservlet-name\u003ekong\u003c/servlet-name\u003e\n           \u003cservlet-class\u003ecom.taofen8.mid.kong.KongDispatcherServlet\u003c/servlet-class\u003e\n           \u003cload-on-startup\u003e1\u003c/load-on-startup\u003e\n       \u003c/servlet\u003e\n       \u003cservlet-mapping\u003e\n            \u003cservlet-name\u003ekong\u003c/servlet-name\u003e\n            \u003curl-pattern\u003e/\u003c/url-pattern\u003e\n       \u003c/servlet-mapping\u003e\n       ```\n        \n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaofen8%2Fkong-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaofen8%2Fkong-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaofen8%2Fkong-client/lists"}