Reports unused path variables in Kotlin router DSL as well as usages of undeclared path variables.

Path variables must be declared in the route path before access. Attempt to access an undeclared path variable will result in a runtime error.

示例:


@Configuration
class RouterConfiguration {
    @Bean
    fun myRouter() = router {
        GET("/test/{var}") { ServerResponse.ok().body("${it.pathVariable("bar")}") }
    }
}

应用修正后:


@Configuration
class RouterConfiguration {
    @Bean
    fun myRouter() = router {
        GET("/test/{var}") { ServerResponse.ok().body("${it.pathVariable("var")}") }
    }
}