diff --git a/sharding-jdbc-core-spring/sharding-jdbc-core-spring-boot-starter/src/main/java/io/shardingjdbc/spring/boot/util/PropertyUtil.java b/sharding-jdbc-core-spring/sharding-jdbc-core-spring-boot-starter/src/main/java/io/shardingjdbc/spring/boot/util/PropertyUtil.java index 6a0edeb106832..c37ff5029d1f2 100644 --- a/sharding-jdbc-core-spring/sharding-jdbc-core-spring-boot-starter/src/main/java/io/shardingjdbc/spring/boot/util/PropertyUtil.java +++ b/sharding-jdbc-core-spring/sharding-jdbc-core-spring-boot-starter/src/main/java/io/shardingjdbc/spring/boot/util/PropertyUtil.java @@ -27,9 +27,9 @@ import io.shardingjdbc.core.exception.ShardingJdbcException; public class PropertyUtil { - + private static int springBootVersion = 1; - + static { try { Class.forName("org.springframework.boot.bind.RelaxedPropertyResolver"); @@ -37,7 +37,7 @@ public class PropertyUtil { springBootVersion = 2; } } - + /** * Spring Boot 1.x is compatible with Spring Boot 2.x by Using Java Reflect. * @param environment : the environment context @@ -50,13 +50,13 @@ public class PropertyUtil { public static T handle(final Environment environment, final String prefix, final Class targetClass) { switch (springBootVersion) { case 1: - return (T) v1(environment, prefix, targetClass); + return (T) v1(environment, prefix); default: return (T) v2(environment, prefix, targetClass); } } - - private static Object v1(final Environment environment, final String prefix, final Class targetClass) { + + private static Object v1(final Environment environment, final String prefix) { try { Class resolverClass = Class.forName("org.springframework.boot.bind.RelaxedPropertyResolver"); Constructor resolverConstructor = resolverClass.getDeclaredConstructor(PropertyResolver.class); @@ -69,7 +69,7 @@ private static Object v1(final Environment environment, final String prefix, fin throw new ShardingJdbcException(ex.getMessage(), ex); } } - + private static Object v2(final Environment environment, final String prefix, final Class targetClass) { try { Class binderClass = Class.forName("org.springframework.boot.context.properties.bind.Binder"); diff --git a/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/main/java/io/shardingjdbc/orchestration/spring/boot/util/PropertyUtil.java b/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/main/java/io/shardingjdbc/orchestration/spring/boot/util/PropertyUtil.java index d442e14eaa14a..5207088fe5aa1 100644 --- a/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/main/java/io/shardingjdbc/orchestration/spring/boot/util/PropertyUtil.java +++ b/sharding-jdbc-orchestration-spring/sharding-jdbc-orchestration-spring-boot-starter/src/main/java/io/shardingjdbc/orchestration/spring/boot/util/PropertyUtil.java @@ -27,9 +27,9 @@ import io.shardingjdbc.core.exception.ShardingJdbcException; public class PropertyUtil { - + private static int springBootVersion = 1; - + static { try { Class.forName("org.springframework.boot.bind.RelaxedPropertyResolver"); @@ -37,7 +37,7 @@ public class PropertyUtil { springBootVersion = 2; } } - + /** * Spring Boot 1.x is compatible with Spring Boot 2.x by Using Java Reflect. * @param environment : the environment context @@ -50,13 +50,13 @@ public class PropertyUtil { public static T handle(final Environment environment, final String prefix, final Class targetClass) { switch (springBootVersion) { case 1: - return (T) v1(environment, prefix, targetClass); + return (T) v1(environment, prefix); default: return (T) v2(environment, prefix, targetClass); } } - - private static Object v1(final Environment environment, final String prefix, final Class targetClass) { + + private static Object v1(final Environment environment, final String prefix) { try { Class resolverClass = Class.forName("org.springframework.boot.bind.RelaxedPropertyResolver"); Constructor resolverConstructor = resolverClass.getDeclaredConstructor(PropertyResolver.class); @@ -69,7 +69,7 @@ private static Object v1(final Environment environment, final String prefix, fin throw new ShardingJdbcException(ex.getMessage(), ex); } } - + private static Object v2(final Environment environment, final String prefix, final Class targetClass) { try { Class binderClass = Class.forName("org.springframework.boot.context.properties.bind.Binder");