Windowsサービスとしてprunsrv
インストールするためにApacheサービスを使用しています。jar
サービスがシャットダウンされると、アプリケーションがクラッシュします。
set PR_STARTMETHOD=main
set PR_STOPMETHOD=exit
私のスタートアップとシャットダウンのクラスは次のようになります。
public class TravelportMainApp {
private static ConfigurableApplicationContext ctx;
public static void main(String[] args) {
ctx = SpringApplication.run(source, args);
ctx.registerShutdownHook();
}
public static void exit(String[] args) throws InterruptedException {
if (ctx != null && ctx instanceof AbstractApplicationContext) {
((AbstractApplicationContext) ctx).destroy();
}
Sysout("EXIT OK.");
}
}
結果: 終了コマンド "EXIT OK" が出力されますが、コマンド ライン アプリがクラッシュし、"commons daemon service runner is not working already." というメッセージが表示されます。ここで何が問題なのですか?