question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ensure that all data store auto-configurations have consistent default connection behaviour

See original GitHub issue

This was raised as part of a discussion on Twitter. The specific example given is Mongo which connects to localhost when it’s on the classpath and Couchbase which doesn’t connect to anything until your configure at least one bootstrap host.

There may well be good reasons for the apparent inconsistency, but it appears to be causing some confusion. It would be nice to align the behaviour across data stores if we can. If there are good reasons not to do that, it would be nice to see if we can somehow make the varying behaviour less surprising.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
abelsromerocommented, Dec 12, 2017

The confusion for us came because of two reasons One, we have been using Couchbase without issues, and when we migrated to MongoDB we had to exclude the autoconfigurer. That felt odd.

Two, how the Autoconfiguration starts and logs the MongoClient behauviour…

  1. if MongoClient is in the classpath and no configuration is present, it attempts to connect a localhost instance.
  2. If connection fails, it does not propagate the error, so the context starts and the app is working fine.
  3. However, the error is logged into the logs just after the "success"message. See attachment. mongoclient-springboot-autcoonfigurer-error.txt

Note: whe use a logback logging configuration importing springs defaults

    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>

Imho, all Autoconfigurators for components depend on some mid-complex configuration should check for properties. Simple things or when a default config is a common thing like Gson or Jackson are fine that they only check for Beans.

Btw, the reason why we have a custom connector and do not expose a MongoClient to the Spring context is because we have a multitennacy platform that manages several connections at once. We load the configurations from a config-service and then initialize all our MongoClients inside a custom bean. That bean is the exposed, but not the clients.

0reactions
wilkinsonacommented, Oct 15, 2020

Neo4j is also affected in a similar way. An app will fail to start when Neo4j can’t be reached. #23707 contains some details, including failures both with and without Actuator.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Binding to Data Services with Spring Boot in Cloud Foundry
In this article we look at how to bind a Spring Boot application to data services (JDBC, NoSQL, messaging etc.) and the various...
Read more >
A Custom Auto-Configuration with Spring Boot - Baeldung
A quick, practical guide to creating a custom auto-configuration in Spring Boot.
Read more >
Spring Cloud GCP
You do not need to include the underlying spring-cloud-gcp-pubsub dependency, ... starters autoconfigure all necessary beans in the default singleton scope.
Read more >
Learn about the Android Device Configuration Service
This data helps Google ensure that your device remains up-to-date and is ... Devices usually connect to the Android Device Configuration service every...
Read more >
Configuring basic system settings Red Hat Enterprise Linux 8
Configuring and managing network access Expand section "3. ... Default behavior is the same as for the dnf-automatic-download.timer unit: it only downloads ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found