1 16 17 package org.springframework.test.jpa; 18 19 import java.util.LinkedList ; 20 import java.util.List ; 21 22 import org.springframework.instrument.classloading.ResourceOverridingShadowingClassLoader; 23 24 35 class OrmXmlOverridingShadowingClassLoader extends ResourceOverridingShadowingClassLoader { 36 37 41 public static final String DEFAULT_ORM_XML_LOCATION = "META-INF/orm.xml"; 42 43 44 private final List <String > providerPrefixes = new LinkedList <String >(); 45 46 { 47 this.providerPrefixes.add("oracle.toplink.essentials"); 49 50 } 54 55 56 public OrmXmlOverridingShadowingClassLoader(ClassLoader loader, String realOrmXmlLocation) { 57 super(loader); 58 override(DEFAULT_ORM_XML_LOCATION, realOrmXmlLocation); 59 } 60 61 @Override 62 protected boolean isClassNameExcludedFromShadowing(String className) { 63 for (String providerPrefix : providerPrefixes) { 64 if (className.startsWith(providerPrefix)) { 65 return true; 66 } 67 } 68 69 if (className.startsWith("junit")) { 71 return true; 72 } 73 74 return false; 75 } 76 77 } 78 | Popular Tags |