title: Spring Boot ApplicationListener not running at app startup
body: <p>I have created a <a href="https://github.com/bitbythecron/spring-boot-troubleshooting" rel="nofollow noreferrer">spring-boot-troubleshooting repo on GitHub</a> that reproduces this error exactly.</p>
  
  <p>I am building a Spring Boot-based REST service and am having difficulty getting a <a href="https://github.com/bitbythecron/spring-boot-troubleshooting/blob/master/src/main/groovy/com/example/bitbythecron/springboottroubleshooting/StartupListener.groovy" rel="nofollow noreferrer">startup listener</a> to work:</p>
  
  <pre><code>@Slf4j
  class StartupListener implements ApplicationListener&lt;ContextRefreshedEvent&gt; {
      @Autowired
      ScheduledReporter metricReporter
  
      @Override
      void onApplicationEvent(ContextRefreshedEvent event) {
          log.info('StartupListener is starting...')
          metricReporter.start(1, TimeUnit.SECONDS)
      }
  }
  </code></pre>
  
  <p>When I run the app:</p>
  
  <pre><code>./gradlew build &amp;&amp; java -Dspring.config=. -jar build/libs/spring-boot-troubleshooting.jar
  </code></pre>
  
  <p>Everything starts up without errors/exceptions, however I never see my "<em>StartupListener is starting...</em>" log message print to the console. This tells me Spring is <em>not</em> firing up my <code>StartupListener</code>. Any ideas what the fix is?</p>