Comments (3)
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.
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.
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 frommongoMappingContext
, 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)
- Spring Cloud Consul does not work well with application context hierarchies and profiles
- Documentation - Clarify disabling of service registration
- Consul Admin Partition Support
- I hope to be able to load both key simultaneously
- The classloader/component “org.springframework.boot.loader.LaunchedURLClassLoader @ 0x800d8c18” occupies 621,015,112 (74.98%) bytes. The memory is accumulated in one instance of “java.lang.Object[]”, loaded by “<system class loader>”, which occupies 601,708,440 (72.65%) bytes. HOT 1
- Runtime reflection is not supported for public void org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties.setHealthCheckPath
- Does the CVE-2022-22965 Vulnerability Affect spring-cloud-circuitbreaker? HOT 1
- How to use Consul as Config center for Spring Cloud Gateway
- Failed to bind properties under 'spring.cloud.consul.config' HOT 2
- Service Discovery not working when using WebClient with Consul HOT 1
- Springboot application restarting after getting warning -Error querying consul Key/Values for context HOT 1
- ConsulConfigProperties not caling init() method in spring-cloud-consul-config:3.1.2
- Depends on web to import a config
- Spring Boot 3.1 Compatibility? HOT 1
- Catalog Watch uses blocking queries incorrectly HOT 1
- Spring Cloud Consul not decrypting the tls key-store-password & certificate-password
- spring.config.import in DynamicPropertySource is not contributed using ConfigDataApplicationContextInitializer in tests
- Accessed Consul cluster's KV store with TLS and ACL enabled through code, but Spring Boot configuration failure
- Support multiple file names in data-key for YML format HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud-consul.