'Spring boot actuator: ReadinessState changed to ACCEPTING_TRAFFIC before Application Starts

My spring boot app includes Spring Cloud Stream. Before the application boot it takes time for Spring Cloud Stream to connect to broker.

So the current sequence

  1. Spring Boot Actuator's ReadinessState changed to ACCEPTING_TRAFFIC
  2. Wait for Spring Cloud Stream Broker
  3. Application Starts.
  4. Again a debug log saying that ReadinessState changed from ACCEPTING_TRAFFIC to ACCEPTING_TRAFFIC

I don't want to state to be ACCEPTING_TRAFFIC on step 1 because application has not started by then. Am I missing something here?

I have added following application properties, and no other configuration

management.endpoint.health.probes.enabled=true
management.health.livenessState.enabled=true
management.health.readinessState.enabled=true


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source