我有一个单身课程
@Singleton
class CustomerBundleSingleton {
def grailsApplication = Holders.getGrailsApplication()
String projName
private CustomerBundleSingleton() {
line 10: projName = // how to get sub-project name here ???
}
}
application.properties // my project is running
-----------------------
app.name = MyNewProject
application.properties // located in sub project
-----------------------
app.name = MySubProject
我尝试grailsApplication.metadata['app.name']
在"line 10:"
它返回"MyNewProject"
。而我想要一种方法来获取位于的 UserBundleSingleton 的项目名称(MySubProjectName)。像 grailsApplication.current.metadata['app.name'] ???? .
这样它就可以给我回来MySubProjectName
而不是MyNewProject
??