我一直在尝试在 Kotlin 项目中使用 Springs @AliasFor
注释,但似乎注释参数上的注释在运行时不可见(因此它没有被 Spring 拾取) .
例如:
@RequestMapping(method = arrayOf(RequestMethod.POST))
annotation class PostMapping(
@get:AliasFor(annotation = RequestMapping::class, attribute = "value")
vararg val value: String = arrayOf())
还有……
// Returns empty array instead of array with the @AliasFor annotation
PostMapping::class.java.methods[0].annotations
有什么我想念的吗?
最佳答案
这是 Kotlin 中的一个错误,目前尚未修复:KT-11475 .
关于java - Kotlin + Spring AliasFor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36535688/