gavlyukovskiy / spring-boot-data-source-decorator

Spring Boot integration with p6spy, datasource-proxy, flexy-pool and spring-cloud-sleuth
Apache License 2.0
859 stars 82 forks source link

Spring Boot Auto Configuration conflicts with DataSource Micrometer Spring Boot project #95

Open ZIRAKrezovic opened 10 months ago

ZIRAKrezovic commented 10 months ago

When using JDBC observability linked from official Spring Boot documentation https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.observability -> https://jdbc-observations.github.io/datasource-micrometer/docs/current/docs/html/ and including the mentioned spring boot starter

<dependency>
    <groupId>net.ttddyy.observation</groupId>
    <artifactId>datasource-micrometer-spring-boot</artifactId>
    <version>1.0.3</version>
</dependency>

Application startup fails when datasource-proxy-spring-boot-starter project is also present as a dependency

<dependency>
    <groupId>com.github.gavlyukovskiy</groupId>
    <artifactId>datasource-proxy-spring-boot-starter</artifactId>
    <version>1.9.1</version>
    <optional>true</optional>
</dependency>

Error:

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

Description:

The bean 'dataSourceNameResolver', defined in class path resource [net/ttddyy/observation/boot/autoconfigure/DataSourceObservationAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [com/github/gavlyukovskiy/boot/jdbc/decorator/DataSourceDecor
atorAutoConfiguration.class] and overriding is disabled.

Not sure who has to fix their bean naming, but it would be nice if any one of you would fix it :)

ZIRAKrezovic commented 10 months ago

https://github.com/jdbc-observations/datasource-micrometer/issues/33

julien92 commented 3 weeks ago

I'm having the same issue, it would be nice if the starter is compatible with datasource-micrometer-spring-boot depdencies