title: Spring Rest Controller - Startup Order
body: <p>I have a requirement to make an endpoint available only after my application has finished starting up.</p>
  
  <p>Currently I am experimenting with the Spring ApplicationListener/ContextRefreshedEvent to capture when Spring has finished initialising.</p>
  
  <p>Is there any way to get it to start my custom Rest endpoint up at this point? I tried using:</p>
  
  <pre><code>BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(ReadinessIndicator.class);
  beanFactory.registerBeanDefinition("readinessIndicator", builder.getBeanDefinition());
  </code></pre>
  
  <p>To add the bean at runtime but it doesn't look like its being initialised.</p>