看起来注解需要 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 中命名常量?