[英]spring boot war deployment url with api gateway
I am using spring boot version 1.5.10.RELEASE. 我正在使用Spring Boot 1.5.10.RELEASE版本。 I have developed on service using spring boot and used Eureka service register, Zuul API Gateway. 我已经使用Spring Boot开发了服务,并使用了Eureka服务寄存器Zuul API Gateway。 My applications pom file application name is "TestApplication" 我的应用程序pom文件应用程序名称为“ TestApplication”
<build>
<finalName>TestApplication</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
And tomcat deployed war name is "testservice.war". 并且tomcat部署的战争名称是“ testservice.war”。
So when I access the URL of application using API Gateway it is formed like below 因此,当我使用API网关访问应用程序的URL时,其格式如下
http://localhost:8080/ApiGateway/testapplication/testservice/swagger-ui.html
format: zuul api gateway context/ applicationname/contextname 格式:zuul api网关上下文/应用程序名称/上下文名称
I want to avoid context name (testservice) in the url and access with eureka registered name only like below: 我想避免在URL中使用上下文名称(testservice),而仅使用eureka注册名称进行访问,如下所示:
http://localhost:8080/ApiGateway/testservice/swagger-ui.html
You can add a route to Zuul .properties
file, something like : 您可以将路由添加到Zuul .properties
文件,例如:
zuul.routes.testapplication.path=/testapplication
zuul.routes.testapplication.service-id=testapplication
Then you can call your service like this : http://APIGATEWAY:8080/testapplication/swagger-ui.html/
然后,您可以像这样调用服务: http://APIGATEWAY:8080/testapplication/swagger-ui.html/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.