JetBrains/kotless

Spring Boot - Error handling multi values in "RequestMaping"

xiujunma opened this issue · 2 comments

@RestController
@RequestMapping("/user")
class UserController(
    @Autowired val userRepository: UserRepository
) {
    @GetMapping(value =["/", ""]) // <- Not able to handle this.
    fun all():Iterable<User> {
        return userRepository.findAll()
    }
}

Execution failed for task ':generate'.
List has more than one element.

This message seems to be caused by the call to currentPath.single() in https://github.com/JetBrains/kotless/blob/master/dsl/spring/spring-lang-parser/src/main/kotlin/io/kotless/parser/spring/processor/route/SpringAnnotationUtils.kt#L48.

Note that there is an explicit check for methods annotated with RequestMapping at line 54.

TanVD commented

Yep, thanks!