簡體   English   中英

在 Spring 響應式 Web (webflux) 中使用“/api”或其他前綴為所有端點添加前綴

[英]Prefix all endpoints with "/api" or another prefix, in spring reactive web (webflux)

我在 Spring 響應式 Web 項目中有一組 RestControllers,我想在不同環境中為所有控制器添加“api”或“test-api”前綴。

我嘗試使用server.servlet.context-path=/api並且它不適用於在 Netty 服務器上運行的 spring 反應式 Web (webflux)

在 spring boot 2.3 中添加了以下屬性以使用 webflux 實現此目的

spring.webflux.base-path

發行說明: https : //github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes#configurable-base-path-for-webflux-applications

您是否嘗試過在 @RequestMapping 中使用占位符,例如 @RequestMapping("${foo.bar}") ?

謝謝

暫無
暫無

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

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