You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor: use SpringJdbcDelegate inner class and ClassUtils.isPresent guard
Replace reflection-based chain walking with direct DelegatingDataSource
and AbstractRoutingDataSource API calls. Isolate spring-jdbc references
in a private inner class so the outer class loads cleanly when spring-jdbc
is absent. ClassUtils.isPresent gates the delegate call, preserving the
original wrap-everything behaviour for non-spring-jdbc environments.
Promote spring-jdbc from test to optional scope to enable compile-time
type checking in the inner class.
Copy file name to clipboardExpand all lines: datasource-micrometer-spring-boot/src/main/java/net/ttddyy/observation/boot/autoconfigure/DataSourceObservationBeanPostProcessor.java
Copy file name to clipboardExpand all lines: datasource-micrometer-spring-boot/src/test/java/net/ttddyy/observation/boot/autoconfigure/DataSourceObservationBeanPostProcessorTests.java
+69Lines changed: 69 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,11 @@
16
16
17
17
packagenet.ttddyy.observation.boot.autoconfigure;
18
18
19
+
importjava.io.File;
20
+
importjava.net.URL;
21
+
importjava.net.URLClassLoader;
19
22
importjava.sql.Connection;
23
+
importjava.util.Arrays;
20
24
importjava.util.Map;
21
25
importjava.util.Set;
22
26
importjava.util.stream.Stream;
@@ -189,6 +193,46 @@ else if (type == DataSourceType.CONCRETE) {
0 commit comments