Spring Framework ResourceLoader - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ResourceLoader class.

This code example shows how to use the following methods:getResource
			} 
			if (resourcePath != null) {
				if (logger.isTraceEnabled()) {
					logger.trace("Trying to locate XML entity [" + systemId + "] as resource [" + resourcePath + "]");
				} 
				Resource resource = this.resourceLoader.getResource(resourcePath);
				source = new InputSource(resource.getInputStream());
				source.setPublicId(publicId);
				source.setSystemId(systemId);
				if (logger.isDebugEnabled()) {
					logger.debug("Found XML entity [" + systemId + "]: " + resource);
				} 
			} 
		} 
		return source;
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getClassLoader
		doRegisterEditor(registry, InputStream.class, new InputStreamEditor(baseEditor));
		doRegisterEditor(registry, InputSource.class, new InputSourceEditor(baseEditor));
		doRegisterEditor(registry, File.class, new FileEditor(baseEditor));
		doRegisterEditor(registry, URL.class, new URLEditor(baseEditor));
 
		ClassLoader classLoader = this.resourceLoader.getClassLoader();
		doRegisterEditor(registry, URI.class, new URIEditor(classLoader));
		doRegisterEditor(registry, Class.class, new ClassEditor(classLoader));
		doRegisterEditor(registry, Class[].class, new ClassArrayEditor(classLoader));
 
		if (this.resourceLoader instanceof ResourcePatternResolver) {
			doRegisterEditor(registry, Resource[].class,
					new ResourceArrayPropertyEditor((ResourcePatternResolver) this.resourceLoader, this.propertyResolver));
		} 
	} 
 
	/** 
	 * Override default editor, if possible (since that's what we really mean to do here); 
	 * otherwise register as a custom editor. 
	 */ 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getResource
	 * Add an SQL script to execute to initialize or populate the database. 
	 * @param script the script to execute 
	 * @return {@code this}, to facilitate method chaining 
	 */ 
	public EmbeddedDatabaseBuilder addScript(String script) {
		this.databasePopulator.addScript(this.resourceLoader.getResource(script));
		return this;
	} 
 
	/** 
	 * Add multiple SQL scripts to execute to initialize or populate the database. 
	 * @param scripts the scripts to execute 
	 * @return {@code this}, to facilitate method chaining 
	 * @since 4.0.3 
	 */ 
	public EmbeddedDatabaseBuilder addScripts(String... scripts) {
		for (String script : scripts) {
			addScript(script);
		} 
		return this;
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getResource
	} 
 
	@Override 
	public InputStream getResourceAsStream(String path) {
		Resource resource = this.resourceLoader.getResource(getResourceLocation(path));
		try { 
			return resource.getInputStream();
		} 
		catch (IOException ex) {
			logger.info("Couldn't open InputStream for " + resource, ex);
			return null; 
		} 
	} 
 
	@Override 
	public int getMajorVersion() { 
		return 2; 
	} 
 
	@Override 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getResource
	 * @see #setResourceLoader 
	 */ 
	@Override 
	public Resource getResource(String location) {
		if (this.resourceLoader != null) {
			return this.resourceLoader.getResource(location);
		} 
		return super.getResource(location);
	} 
 
	/** 
	 * This implementation delegates to this context's ResourceLoader if it 
	 * implements the ResourcePatternResolver interface, falling back to the 
	 * default superclass behavior else. 
	 * @see #setResourceLoader 
	 */ 
	@Override 
	public Resource[] getResources(String locationPattern) throws IOException {
		if (this.resourceLoader instanceof ResourcePatternResolver) {
			return ((ResourcePatternResolver) this.resourceLoader).getResources(locationPattern);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getResource
        return extension;
    } 
 
    public void setResourceLoader(ResourceLoader resourceLoader) {
        helper = new LocalizedResourceHelper(resourceLoader);
    } 
} 

4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getClassLoader
 * The document reader will register each bean definition with the given bean factory, 
 * talking to the latter's implementation of the 
 * {@link org.springframework.beans.factory.support.BeanDefinitionRegistry} interface. 
 * 
 * @author Juergen Hoeller 
 * @author Rob Harrop 
 * @author Chris Beams 
 * @since 26.11.2003 
 * @see #setDocumentReaderClass 
 * @see BeanDefinitionDocumentReader 
 * @see DefaultBeanDefinitionDocumentReader 
 * @see BeanDefinitionRegistry 
 * @see org.springframework.beans.factory.support.DefaultListableBeanFactory 
 * @see org.springframework.context.support.GenericApplicationContext 
 */ 
public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
 
	/** 
	 * Indicates that the validation should be disabled. 
	 */ 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getResource
		} 
	} 
 
	@Override 
	public URL getResource(String path) throws MalformedURLException { 
		Resource resource = this.resourceLoader.getResource(getResourceLocation(path)); 
		if (!resource.exists()) { 
			return null; 
		} 
		try { 
			return resource.getURL(); 
		} 
		catch (MalformedURLException ex) { 
			throw ex; 
		} 
		catch (IOException ex) { 
			logger.warn("Couldn't get URL for " + resource, ex); 
			return null; 
		} 
	} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Spring Framework ResourceLoader Methods: