cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [cayenne] 04/04: CAY-2573 DI field injection is triggered when creating sql Driver
Date Sat, 04 May 2019 15:01:06 GMT
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 91992935b9de28f9b5739b0b763b90520675c77e
Author: Nikita Timofeev <stariy95@gmail.com>
AuthorDate: Sat May 4 18:00:42 2019 +0300

    CAY-2573 DI field injection is triggered when creating sql Driver
---
 RELEASE-NOTES.txt                                                       | 1 +
 .../cayenne/dbsync/reverse/configuration/DriverDataSourceFactory.java   | 2 +-
 .../apache/cayenne/configuration/server/PropertyDataSourceFactory.java  | 2 +-
 .../cayenne/configuration/server/XMLPoolingDataSourceFactory.java       | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 1cce2d2..aee19d7 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -51,6 +51,7 @@ CAY-2553 Wrong disjoint prefetch query qualifier
 CAY-2559 Modeler: Warning dialog shows wrong information after changing target entity in
dbRelationship
 CAY-2561 Modeler: cgen type combobox doesn't set templates
 CAY-2572 Queries are not sorted by name in data map XML
+CAY-2573 DI field injection is triggered when creating sql Driver
 CAY-2575 Select translator: Wrong translation of IN Expression
 CAY-2576 Ant cgen task is broken
 
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/DriverDataSourceFactory.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/DriverDataSourceFactory.java
index d24f367..a124c13 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/DriverDataSourceFactory.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/DriverDataSourceFactory.java
@@ -47,7 +47,7 @@ public class DriverDataSourceFactory implements DataSourceFactory {
 			throw new IllegalArgumentException("'nodeDescriptor' contains no datasource descriptor");
 		}
 
-		Driver driver = objectFactory.newInstance(Driver.class, properties.getJdbcDriver());
+		Driver driver = (Driver)objectFactory.getJavaClass(properties.getJdbcDriver()).newInstance();
 		return new DriverDataSource(driver, properties.getDataSourceUrl(), properties.getUserName(),
 				properties.getPassword());
 	}
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.java
index d3fc1ac..365e875 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.java
@@ -71,7 +71,7 @@ public class PropertyDataSourceFactory implements DataSourceFactory {
 				UnmanagedPoolingDataSource.MAX_QUEUE_WAIT_DEFAULT);
 		String validationQuery = properties.get(Constants.JDBC_VALIDATION_QUERY_PROPERTY);
 
-		Driver driver = objectFactory.newInstance(Driver.class, driverClass);
+		Driver driver = (Driver)objectFactory.getJavaClass(driverClass).newInstance();
 		return DataSourceBuilder.url(url).driver(driver).userName(username).password(password)
 				.pool(minConnections, maxConnections).maxQueueWaitTime(maxQueueWaitTime)
 				.validationQuery(validationQuery).build();
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java
index e99d78d..d0d07af 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java
@@ -67,7 +67,7 @@ public class XMLPoolingDataSourceFactory implements DataSourceFactory {
 		long maxQueueWaitTime = properties.getLong(Constants.JDBC_MAX_QUEUE_WAIT_TIME,
 				UnmanagedPoolingDataSource.MAX_QUEUE_WAIT_DEFAULT);
 
-		Driver driver = objectFactory.newInstance(Driver.class, descriptor.getJdbcDriver());
+		Driver driver = (Driver)objectFactory.getJavaClass(descriptor.getJdbcDriver()).newInstance();
 
 		return DataSourceBuilder.url(descriptor.getDataSourceUrl()).driver(driver).userName(descriptor.getUserName())
 				.password(descriptor.getPassword())


Mime
View raw message