Skip to content

Commit 43151ca

Browse files
committed
docs: Document default port and ephemeral port usage
1 parent f6ee80e commit 43151ca

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ Register a custom mapper for any media type via `Builder.bodyMapper(mediaType, m
218218

219219
User-supplied mappers take precedence over built-in defaults, so you can override any of the above.
220220

221+
#### Listen port
222+
223+
`Builder.port(int)` is optional and defaults to `8080`. Pass `0` to bind on an ephemeral port and read the actual port back via `OpenApiServer.listenPort()` — useful for tests.
224+
221225
#### Restricting to the loopback interface
222226

223227
By default the server binds to the wildcard address (all local interfaces). To restrict it to loopback — useful for local development or sidecar processes — supply a bind address:

src/main/java/com/retailsvc/http/OpenApiServer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ public Builder exceptionHandler(ExceptionHandler exceptionHandler) {
254254
return this;
255255
}
256256

257+
/**
258+
* Sets the TCP port to listen on. Defaults to {@value #DEFAULT_PORT} when not set. Use {@code
259+
* 0} to bind on an ephemeral port (read it back via {@link OpenApiServer#listenPort()}).
260+
*/
257261
public Builder port(int port) {
258262
this.port = port;
259263
return this;

0 commit comments

Comments
 (0)