1

The goal is to configure my webflux servlet container such that whenever an API call is made to a predefined path will return a response regardless of whether the call is made to an upper/lower case path.

/api/users should give the same result as /api/USERS

This functional route definition along with the WebFluxConfigurer below does not appear to settle it.

@Configuration
class UserRoutes {

    @Bean
    fun userRouterFunction(
        userHandler: userHandler
    ) = coRouter {
        "/users".nest {
            GET("/all", userHandler::getAllUser)

@Configuration
@EnableWebFlux
class WebConfig : WebFluxConfigurer {

    override fun configurePathMatching(configurer: PathMatchConfigurer) {
        configurer.setUseCaseSensitiveMatch(false)
    }
}

Is anything amiss here?

Maxiepaxie
  • 53
  • 6

1 Answers1

1

@Configuration classes must not be final. Change its access modifier to open

@Configuration
@EnableWebFlux
open class WebConfig : WebFluxConfigurer {
    override fun configurePathMatching(configurer: PathMatchConfigurer) {
        configurer.setUseCaseSensitiveMatch(false)
    }
}

This works. I just tested.

mahan
  • 12,366
  • 5
  • 48
  • 83
  • The @Configuration annotation modifies the class to open by default. On a different note, I think the problem is with the functional definition of paths where I use CoRouterFunctionDsl. Am I to assume that the WebFluxConfigurer interface will not work for those paths? – Maxiepaxie Sep 13 '21 at 20:16