@@ -56,6 +56,8 @@ This project is sponsored by
5656 - [ Error Handling for REST using @ControllerAdvice ] ( #error-handling-for-rest-using-controlleradvice )
5757 - [ Adding API Information and Security documentation] ( #adding-api-information-and-security-documentation )
5858 - [ spring-webflux support with Annotated Controllers] ( #spring-webflux-support-with-annotated-controllers )
59+ - [ Using a separate management port (Spring Boot 3)] ( #using-a-separate-management-port-spring-boot-3 )
60+ - [ When Spring Security is enabled] ( #when-spring-security-is-enabled )
5961- [ Acknowledgements] ( #acknowledgements )
6062 - [ Contributors] ( #contributors )
6163 - [ Additional Support] ( #additional-support )
@@ -253,6 +255,59 @@ Snapshots:
253255* [ https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/org/springdoc/ ] ( https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/org/springdoc/ )
254256 .
255257
258+ ## Using a separate management port (Spring Boot 3)
259+
260+ Some Spring Boot apps run ** Actuator** on a separate management port. In that case:
261+
262+ - ** Application port** (e.g., ` 8080 ` ) serves your app and springdoc endpoints:
263+ - ` http://localhost:8080/v3/api-docs `
264+ - ` http://localhost:8080/swagger-ui/index.html `
265+
266+ - ** Management port** (e.g., ` 9090 ` ) serves Actuator:
267+ - ` http://localhost:9090/actuator `
268+ - ` http://localhost:9090/actuator/health `
269+
270+ Minimal ` application.yml ` :
271+
272+ ``` yaml
273+ server :
274+ port : 8080
275+
276+ management :
277+ server :
278+ port : 9090
279+ endpoints :
280+ web :
281+ exposure :
282+ include : health,info
283+
284+ # springdoc is enabled by default with the starter;
285+ # endpoints remain on the application port.
286+ # (OpenAPI JSON = /v3/api-docs, Swagger UI = /swagger-ui/index.html)
287+ ```
288+
289+ ### When Spring Security is enabled
290+
291+ With Spring Boot 3, ` /v3/api-docs ` and Swagger UI are served on the ** application port** , while Actuator runs on the ** management port** .
292+ If Spring Security is enabled, explicitly permit the docs paths on the ** application port** :
293+
294+ ``` java
295+ @Bean
296+ SecurityFilterChain api(HttpSecurity http) throws Exception {
297+ http
298+ .authorizeHttpRequests(auth - > auth
299+ .requestMatchers(
300+ " /v3/api-docs/**" ,
301+ " /v3/api-docs.yaml" ,
302+ " /swagger-ui/**" ,
303+ " /swagger-ui.html"
304+ ). permitAll()
305+ .anyRequest(). authenticated()
306+ );
307+ return http. build();
308+ }
309+ ```
310+
256311# Acknowledgements
257312
258313## Contributors
0 commit comments