Kotlin + Spring AliasFor

Art*_*hur 4 java spring kotlin

我一直在尝试@AliasFor在Kotlin项目中使用Springs 注释,但似乎注释参数上的注释在运行时是不可见的(因此它不会被Spring选中).

例如:

@RequestMapping(method = arrayOf(RequestMethod.POST))
annotation class PostMapping(
    @get:AliasFor(annotation = RequestMapping::class, attribute = "value")
    vararg val value: String = arrayOf())
Run Code Online (Sandbox Code Playgroud)

和...

// Returns empty array instead of array with the @AliasFor annotation
PostMapping::class.java.methods[0].annotations
Run Code Online (Sandbox Code Playgroud)

有什么我想念的吗?

Mic*_*ael 6

这是Kotlin的一个错误,目前还没有修复:KT-11475.