看起来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不认可静态final val作为常量值。
在这里有什么可以做的,或者说在Scala中是否不可能拥有命名常量?
没问题。