Hi,

I noticed it's possible to use SERVER_PORT with native build, but MANAGEMENT_SERVER_PORT is ignored. Didn't found documentation about it, so I'd like to ask if this is by design or a bug.

Spring Boot version is 3.3.8

Thanks

Comment From: wilkinsona

It's by design.

If you build your native image with everything running on server.port, setting management.server.port will have no effect in a native image. It has no effect because switching to a separate management port significantly changes the classes used by the application and the beans that it contains. This is the second bullet in the list that's documented here.

On the other hand, if you build your native image with a separate management.server.port you will be able to customise that port at runtime as the image with contain everything that's necessary for a separate management server. You won't, however, be able to go back to running everything on the same port as the classes required for this won't be present in the image.