General defensiveness about the bootstrap ClassLoader (i.e. null ClassLoader)

Issue: SPR-11721
This commit is contained in:
Juergen Hoeller
2014-04-23 23:54:55 +02:00
parent 2c1203dc9f
commit 9e2060707a
30 changed files with 230 additions and 180 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 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.
@@ -27,6 +27,7 @@ import org.hibernate.type.TypeFactory;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
/**
@@ -73,8 +74,8 @@ public class FilterDefinitionFactoryBean implements FactoryBean<FilterDefinition
static {
// Hibernate 3.6 TypeResolver class available?
try {
Class<?> trClass = FilterDefinitionFactoryBean.class.getClassLoader().loadClass(
"org.hibernate.type.TypeResolver");
Class<?> trClass = ClassUtils.forName("org.hibernate.type.TypeResolver",
FilterDefinitionFactoryBean.class.getClassLoader());
heuristicTypeMethod = trClass.getMethod("heuristicType", String.class);
typeResolver = trClass.newInstance();
}