以编程方式查找Netty端口spring boot 2

时间:2017-11-14 19:20:10

标签: spring-boot spring-cloud-netflix

我想知道如何在弹簧启动2 + Spring Spring Finchley应用程序启动时以编程方式找到netty端口?

我在EC2容器服务中的AWS上的docker容器中运行服务 - 因此我设置了server.port = 0,并且不能使用此属性来查找实际使用的端口。

1 个答案:

答案 0 :(得分:2)

在spring-boot 2中,您可以使用@LocalServerPort连接所使用的动态端口 https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/web/server/LocalServerPort.html

相关问题