0
このエラーを正確に再現するspring-boot-troubleshooting repo on GitHubを作成しました。アプリケーション起動時にSpring起動ApplicationListenerが実行されない
私は春ブーツベースのRESTサービスを構築していますし、難しい仕事にstartup listenerを取得して過ごしています:
@Slf4j
class StartupListener implements ApplicationListener<ContextRefreshedEvent> {
@Autowired
ScheduledReporter metricReporter
@Override
void onApplicationEvent(ContextRefreshedEvent event) {
log.info('StartupListener is starting...')
metricReporter.start(1, TimeUnit.SECONDS)
}
}
私はアプリを実行すると:
./gradlew build && java -Dspring.config=. -jar build/libs/spring-boot-troubleshooting.jar
すべてがエラーなしで起動します/しかし、私は "StartupListenerが起動しています..."というログメッセージをコンソールに表示することはありません。これは、私の春がではなく、StartupListener
であることを意味します。解決策は何ですか?