Skip to content

how to get the http listenning port in runtime in my code? #36051

Answered by HerrDerb
lost22git asked this question in Q&A
Discussion options

You must be logged in to vote

I would try and read the property quarkus.http.port which I assume should hold the port.

@ApplicationScope
public class Startup {
  @ConfigProperty(name="quarkus.http.port")
  int port;

  public void run(@Observe StartupEvent event) {
    System.out.println("Current port "+ port);
  }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lost22git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants