Skip to content

SpringMVC nested RouterFunctions are not created properly #49289

@zolkiss

Description

@zolkiss

Hello!

Currently, I'm migrating over the non-reactive RouterFunctions with Spring Boot 4.0.3 using this code:

    @Bean
    public RouterFunction<ServerResponse> testEndpoints() {
        return RouterFunctions.route()
                .path("/rootPath", customizer -> customizer
                        .GET("/subPathOne", request -> ServerResponse.ok().build())
                        .GET("/subPathTwo", request -> ServerResponse.ok().build()))
                .build();

    }

While the RouterFunctions are built properly (or at least the structure looks good), the generated EndPoints are missing the actual structure, and in case of the sample above only the /subPathOne and /subPathTwo endpoints are registered:
Image

Spring-Boot version: 4.0.3 (but tested with 4.1.0.M2 with the same result)
Java version: Temurin JDK 25
Sample application: https://github.com/zolkiss/spring-routing-sample

So far what I found is that the RouterFunctionMappingDescriptionProvider#describe Method does not generating correctly. While the mappings are looking OK, the visitor's description does not:
Image

Tried a different syntax, the result is the same

   @Bean
   public RouterFunction<ServerResponse> testAlternative() {
       return RouterFunctions.route()
               .nest(path("/altPath"), customizer -> customizer
                       .GET("/subPathOne", request -> ServerResponse.ok().build())
                       .GET("/subPathTwo", request -> ServerResponse.ok().build()))
               .build();
   }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions