Giter Site home page Giter Site logo

Comments (3)

gc-garcol avatar gc-garcol commented on June 10, 2024 1

in heartbeat, set use-actuator-health to false

        heartbeat:
            use-actuator-health: false
            enabled: true

You can check the ConsulHeartbeatAutoConfiguration to find out the issue

@ConditionalOnProperty(value = "spring.cloud.consul.discovery.heartbeat.use-actuator-health", havingValue = "true",
			matchIfMissing = true)
	static class ActuatorBasedApplicationStatusProviderConfig

from spring-cloud-consul.

ghimisradu avatar ghimisradu commented on June 10, 2024

I'm having the same issue, but without overriding anything from consul, just having spring-cloud-starter-consul-discovery, spring-boot-starter-actuator and spring-boot-starter-data-mongodb-reactive on the same classpath and enabling the spring.cloud.consul.discovery.heartbeat.enabled=true.
Here's a reproduction project

from spring-cloud-consul.

chillb0nes avatar chillb0nes commented on June 10, 2024

Startup and comes with dependency cycle for consul's TtlScheduler! Here is my example with logs, spring_consul_err.

Copying the cycle here for clarity

***************************
APPLICATION FAILED TO START
***************************

Description:

The dependencies of some of the beans in the application context form a cycle:

   stationController defined in file [/Users/clemon/Downloads/demo/build/classes/java/main/com/example/demo/station/StationController.class]
┌─────┐
|  mongoTemplate defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDatabaseFactoryDependentConfiguration.class]
↑     ↓
|  mappingMongoConverter defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDatabaseFactoryDependentConfiguration.class]
↑     ↓
|  mongoMappingContext defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDataConfiguration.class]
↑     ↓
|  consulAutoServiceRegistrationListener defined in class path resource [org/springframework/cloud/consul/serviceregistry/ConsulAutoServiceRegistrationAutoConfiguration.class]
↑     ↓
|  consulAutoServiceRegistration defined in class path resource [org/springframework/cloud/consul/serviceregistry/ConsulAutoServiceRegistrationAutoConfiguration.class]
↑     ↓
|  commonConsulServiceRegistry defined in class path resource [com/example/demo/consul/CommonConsulAutoConfiguration.class]
↑     ↓
|  ttlScheduler defined in class path resource [org/springframework/cloud/consul/support/ConsulHeartbeatAutoConfiguration.class]
↑     ↓
|  actuatorHealthStatusProvider defined in class path resource [org/springframework/cloud/consul/support/ConsulHeartbeatAutoConfiguration$ActuatorBasedApplicationStatusProviderConfig.class]
↑     ↓
|  healthEndpoint defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]
↑     ↓
|  healthContributorRegistry defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]
↑     ↓
|  mongoHealthContributor defined in class path resource [org/springframework/boot/actuate/autoconfigure/data/mongo/MongoHealthContributorAutoConfiguration.class]
└─────┘

Here is my analysis:

  • mongoMappingContext is a InitializingBean
  • During initialization it produces MappingContextEvents (which is subtype of ApplicationEvent)
  • consulAutoServiceRegistrationListener is a SmartApplicationListener
  • SmartApplicationListener extends ApplicationListener<ApplicationEvent>
  • So it is necessary to create consulAutoServiceRegistrationListener to handle events from mongoMappingContext, thus cycle appears

WebServerInitializedEvent is the only event type that consulAutoServiceRegistrationListener can process, so It should be enough to explicitly declare it in bean definiton to fix this issue. Either by changing implements SmartApplicationListener to implements ApplicationListener<WebServerInitializedEvent> or annotating onApplicationEvent method with @EventListener(WebServerInitializedEvent.class).

Unfortunately I don't have time to test this hypothesis, but I would be glad if someone could do it and submit a PR if everything works fine.

from spring-cloud-consul.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.