Java Code Examples for org.springframework.util.ClassUtils#getDefaultClassLoader()

The following examples show how to use org.springframework.util.ClassUtils#getDefaultClassLoader() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassPathResource.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Create a new {@code ClassPathResource} for {@code ClassLoader} usage.
 * A leading slash will be removed, as the ClassLoader resource access
 * methods will not accept it.
 * @param path the absolute path within the classpath
 * @param classLoader the class loader to load the resource with,
 * or {@code null} for the thread context class loader
 * @see ClassLoader#getResourceAsStream(String)
 */
public ClassPathResource(String path, @Nullable ClassLoader classLoader) {
	Assert.notNull(path, "Path must not be null");
	String pathToUse = StringUtils.cleanPath(path);
	if (pathToUse.startsWith("/")) {
		pathToUse = pathToUse.substring(1);
	}
	this.path = pathToUse;
	this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
}
 
Example 2
Source File: SpelCompiler.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Factory method for compiler instances. The returned SpelCompiler will
 * attach a class loader as the child of the given class loader and this
 * child will be used to load compiled expressions.
 * @param classLoader the ClassLoader to use as the basis for compilation
 * @return a corresponding SpelCompiler instance
 */
public static SpelCompiler getCompiler(@Nullable ClassLoader classLoader) {
	ClassLoader clToUse = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
	synchronized (compilers) {
		SpelCompiler compiler = compilers.get(clToUse);
		if (compiler == null) {
			compiler = new SpelCompiler(clToUse);
			compilers.put(clToUse, compiler);
		}
		return compiler;
	}
}
 
Example 3
Source File: InstrumentationLoadTimeWeaver.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/**
 * Create a new InstrumentationLoadTimeWeaver for the default ClassLoader.
 */
public InstrumentationLoadTimeWeaver() {
	this(ClassUtils.getDefaultClassLoader());
}
 
Example 4
Source File: AbstractBeanFactory.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
	this.beanClassLoader = (beanClassLoader != null ? beanClassLoader : ClassUtils.getDefaultClassLoader());
}
 
Example 5
Source File: MockServletContext.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public ClassLoader getClassLoader() {
	return ClassUtils.getDefaultClassLoader();
}
 
Example 6
Source File: StubWebApplicationContext.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public ClassLoader getClassLoader() {
	return ClassUtils.getDefaultClassLoader();
}
 
Example 7
Source File: MockServletContext.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Nullable
public ClassLoader getClassLoader() {
	return ClassUtils.getDefaultClassLoader();
}
 
Example 8
Source File: MutablePersistenceUnitInfo.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * This implementation returns the default ClassLoader.
 * @see org.springframework.util.ClassUtils#getDefaultClassLoader()
 */
@Override
public ClassLoader getClassLoader() {
	return ClassUtils.getDefaultClassLoader();
}
 
Example 9
Source File: InstrumentationLoadTimeWeaver.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create a new InstrumentationLoadTimeWeaver for the default ClassLoader.
 */
public InstrumentationLoadTimeWeaver() {
	this(ClassUtils.getDefaultClassLoader());
}
 
Example 10
Source File: ServerTraceMetadataLoaderService.java    From pinpoint with Apache License 2.0 4 votes vote down vote up
public ServerTraceMetadataLoaderService(CommonLoggerFactory commonLoggerFactory) {
    this(ClassUtils.getDefaultClassLoader(), Collections.singletonList(DEFAULT_TYPE_PROVIDER_PATH), commonLoggerFactory);
}
 
Example 11
Source File: StubResourceLoader.java    From spring-cloud-deployer with Apache License 2.0 4 votes vote down vote up
@Override
public ClassLoader getClassLoader() {
	return ClassUtils.getDefaultClassLoader();
}
 
Example 12
Source File: URIEditor.java    From blog_demos with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new URIEditor, using the given ClassLoader to resolve
 * "classpath:" locations into physical resource URLs.
 * @param classLoader the ClassLoader to use for resolving "classpath:" locations
 * (may be {@code null} to indicate the default ClassLoader)
 */
public URIEditor(ClassLoader classLoader) {
	this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
	this.encode = true;
}
 
Example 13
Source File: SimpleLoadTimeWeaver.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new {@code SimpleLoadTimeWeaver} for the current context
 * {@code ClassLoader}.
 * @see SimpleInstrumentableClassLoader
 */
public SimpleLoadTimeWeaver() {
	this.classLoader = new SimpleInstrumentableClassLoader(ClassUtils.getDefaultClassLoader());
}
 
Example 14
Source File: ClassEditor.java    From blog_demos with Apache License 2.0 2 votes vote down vote up
/**
 * Create a default ClassEditor, using the given ClassLoader.
 * @param classLoader the ClassLoader to use
 * (or {@code null} for the thread context ClassLoader)
 */
public ClassEditor(ClassLoader classLoader) {
	this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
}
 
Example 15
Source File: ReflectiveLoadTimeWeaver.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Create a new ReflectiveLoadTimeWeaver for the current context class
 * loader, <i>which needs to support the required weaving methods</i>.
 */
public ReflectiveLoadTimeWeaver() {
	this(ClassUtils.getDefaultClassLoader());
}
 
Example 16
Source File: WebSphereLoadTimeWeaver.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a new instance of the {@link WebSphereLoadTimeWeaver} class using
 * the default {@link ClassLoader class loader}.
 * @see org.springframework.util.ClassUtils#getDefaultClassLoader()
 */
public WebSphereLoadTimeWeaver() {
	this(ClassUtils.getDefaultClassLoader());
}
 
Example 17
Source File: StandardTypeLocator.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Create a StandardTypeLocator for the default ClassLoader
 * (typically, the thread context ClassLoader).
 */
public StandardTypeLocator() {
	this(ClassUtils.getDefaultClassLoader());
}
 
Example 18
Source File: DefaultNamespaceHandlerResolver.java    From blog_demos with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new {@code DefaultNamespaceHandlerResolver} using the
 * supplied mapping file location.
 * @param classLoader the {@link ClassLoader} instance used to load mapping resources
 * may be {@code null}, in which case the thread context ClassLoader will be used)
 * @param handlerMappingsLocation the mapping file location
 */
public DefaultNamespaceHandlerResolver(ClassLoader classLoader, String handlerMappingsLocation) {
	Assert.notNull(handlerMappingsLocation, "Handler mappings location must not be null");
	this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
	this.handlerMappingsLocation = handlerMappingsLocation;
}
 
Example 19
Source File: URIEditor.java    From blog_demos with Apache License 2.0 2 votes vote down vote up
/**
 * Create a new URIEditor, using the given ClassLoader to resolve
 * "classpath:" locations into physical resource URLs.
 * @param classLoader the ClassLoader to use for resolving "classpath:" locations
 * (may be {@code null} to indicate the default ClassLoader)
 * @param encode indicates whether Strings will be encoded or not
 */
public URIEditor(ClassLoader classLoader, boolean encode) {
	this.classLoader = (classLoader != null ? classLoader : ClassUtils.getDefaultClassLoader());
	this.encode = encode;
}
 
Example 20
Source File: StandardTypeLocator.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a StandardTypeLocator for the default ClassLoader
 * (typically, the thread context ClassLoader).
 */
public StandardTypeLocator() {
	this(ClassUtils.getDefaultClassLoader());
}