簡體   English   中英

使用API​​網關的Spring Boot War部署URL

[英]spring boot war deployment url with api gateway

我正在使用Spring Boot 1.5.10.RELEASE版本。 我已經使用Spring Boot開發了服務,並使用了Eureka服務寄存器Zuul API Gateway。 我的應用程序pom文件應用程序名稱為“ TestApplication”

<build>
    <finalName>TestApplication</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

並且tomcat部署的戰爭名稱是“ testservice.war”。

因此,當我使用API​​網關訪問應用程序的URL時,其格式如下

http://localhost:8080/ApiGateway/testapplication/testservice/swagger-ui.html

格式:zuul api網關上下文/應用程序名稱/上下文名稱

我想避免在URL中使用上下文名稱(testservice),而僅使用eureka注冊名稱進行訪問,如下所示:

http://localhost:8080/ApiGateway/testservice/swagger-ui.html

您可以將路由添加到Zuul .properties文件,例如:

zuul.routes.testapplication.path=/testapplication
zuul.routes.testapplication.service-id=testapplication

然后,您可以像這樣調用服務: http://APIGATEWAY:8080/testapplication/swagger-ui.html/

暫無
暫無

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

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