簡體   English   中英

如何從GitLab中存儲的springboot項目獲取微服務端點列表

[英]How to get the list of microservices endpoints from springboot projects stored in GitLab

我在GitLab管理着多個springboot項目,目前API端點是手動提取的,通過GitLab中的代碼文件一個一個瀏覽,獲取每個項目可用的端點。 有沒有辦法通過像 python 這樣的編碼從所有項目中獲取微服務端點列表?

示例 controller class:

@RestController 公共 class TestController {

@GetMapping("/testapi")
public String TestApi(){
    return "call to /testapi";
}
@PostMapping("/testapi2")
public String TestApi2(){
    return "call to /testapi2";
}

預期結果:

  1. 端點-/testapi方法-GET
  2. 端點-/testapi2方法-POST

如果不部署服務/項目,我不確定是否有一種簡單的方法可以做到這一點。

如果您可以部署服務/項目,一種發現所有端點的簡單方法是將 openapi/swagger 添加到您的項目中。

在這里,您可以找到將其添加到 spring 啟動應用程序所需的內容。 https://github.com/springdoc/springdoc-openapi

https://www.baeldung.com/spring-rest-openapi-documentation

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM