在我的应用程序中,我使用注释来标记我希望在应用程序的“onStart”挂钩期间执行的一些方法。我的代码是这样的:
@Override
public void onStart(Application app) {
Reflections reflections = new Reflections("", new SubTypesScanner(false), new MethodAnnotationsScanner(), app.classloader()); //also tried without classloader
Set<Method> onStartMethods = reflections.getMethodsAnnotatedWith(OnStart.class); //OnStart is my annotation
if (CollectionUtils.isNotEmpty(onStartMethods)) {
for (Method osm : onStartMethods) {
// execute the methods
}
} else {
// I CRASH the server because this is not a behaviour I want
}
}
有一点这工作 FLAWLESSSLY 两者都使用play run
,play start
但如果我使用它就不再工作了play dist
。该错误发生在我们的测试服务器(EC2 ubuntu 13.10)和我的开发机器(Ubuntu 14.04LTS)上。
我用它在我的机器上进行测试。
$alias testdeploy
alias testdeploy='play compile && play dist && unzip -o target/universal/*.zip -d ~/test-deploy/ && bash ~/test-deploy/server_crm-1.0/bin/server_crm'
我正在将 Java7 与 Play 一起使用!2.2. 我需要一些见解。发生了什么事......最重要的是我该如何解决这个问题?
更新:当然我也测试play stage
过......结果与dist