I have a spring boot application (using embedded tomcat 7), and I've set server.port = 0
in my application.properties
so I can have a random port. After the server is booted up and running on a port, I need to be able to get the port that that was chosen.
I cannot use @Value("$server.port")
because it's zero. This is a seemingly simple piece of information, so why can't I access it from my java code? How can I access it?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…