私のアプリケーションでは、注釈を使用して、アプリケーションの「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
}
}
一点、これは両方使っ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'
PlayでJava7を使用しています! 2.2. 私はいくつかの洞察を必要としています。何が起こっているのですか...そして何よりも、どうすればこれを修正できますか?
更新:もちろん私もテストしplay stage
ました...と同じ結果dist