【发布时间】:2013-09-27 22:13:53
【问题描述】:
看起来注解在 Java 中需要常量。我想做:
object ConfigStatics {
final val componentsToScan = Array("com.example")
}
@PropertySource( ConfigStatics.componentsToScan ) // error: constant value required
class MyConfig extends WebMvcConfigurerAdapter {
}
在哪里
@PropertySource( Array("com.example") )
class MyConfig extends WebMvcConfigurerAdapter {
}
很好。
遗憾的是,scala 无法将静态最终 val 识别为常量值。
这里有什么可做的吗,还是根本不可能在 scala 中命名常量?
【问题讨论】:
标签: scala