Consistent use of ClassUtils.forName instead of class.getClassLoader().loadClass
Issue: SPR-11780
This commit is contained in:
parent
f651065b5e
commit
551950cdc0
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -89,7 +89,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
|||
|
||||
static {
|
||||
try {
|
||||
zoneIdClass = PropertyEditorRegistrySupport.class.getClassLoader().loadClass("java.time.ZoneId");
|
||||
zoneIdClass = ClassUtils.forName("java.time.ZoneId", PropertyEditorRegistrySupport.class.getClassLoader());
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
// Java 8 ZoneId class not available
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -33,6 +33,7 @@ import org.hibernate.service.Service;
|
|||
|
||||
import org.springframework.transaction.jta.UserTransactionAdapter;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Implementation of Hibernate 4's JtaPlatform SPI (which has a different package
|
||||
|
|
@ -51,14 +52,14 @@ class ConfigurableJtaPlatform implements InvocationHandler {
|
|||
Class<?> jpClass;
|
||||
try {
|
||||
// Try Hibernate 4.0-4.2 JtaPlatform variant
|
||||
jpClass = SpringSessionContext.class.getClassLoader().loadClass(
|
||||
"org.hibernate.service.jta.platform.spi.JtaPlatform");
|
||||
jpClass = ClassUtils.forName("org.hibernate.service.jta.platform.spi.JtaPlatform",
|
||||
ConfigurableJtaPlatform.class.getClassLoader());
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
try {
|
||||
// Try Hibernate 4.3 JtaPlatform variant
|
||||
jpClass = SpringSessionContext.class.getClassLoader().loadClass(
|
||||
"org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform");
|
||||
jpClass = ClassUtils.forName("org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform",
|
||||
ConfigurableJtaPlatform.class.getClassLoader());
|
||||
}
|
||||
catch (ClassNotFoundException ex2) {
|
||||
throw new IllegalStateException("Neither Hibernate 4.0-4.2 nor 4.3 variant of JtaPlatform found");
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class LocalSessionFactoryBuilder extends Configuration {
|
|||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends Annotation> converterAnnotation = (Class<? extends Annotation>)
|
||||
LocalSessionFactoryBuilder.class.getClassLoader().loadClass("javax.persistence.Converter");
|
||||
ClassUtils.forName("javax.persistence.Converter", LocalSessionFactoryBuilder.class.getClassLoader());
|
||||
entityTypeFilters.add(new AnnotationTypeFilter(converterAnnotation, false));
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class DefaultPersistenceUnitManager
|
|||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends Annotation> converterAnnotation = (Class<? extends Annotation>)
|
||||
DefaultPersistenceUnitManager.class.getClassLoader().loadClass("javax.persistence.Converter");
|
||||
ClassUtils.forName("javax.persistence.Converter", DefaultPersistenceUnitManager.class.getClassLoader());
|
||||
entityTypeFilters.add(new AnnotationTypeFilter(converterAnnotation, false));
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue