Spring Framework DefaultResourceLoader - 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 DefaultResourceLoader class.

This code example shows how to use the following methods:
	protected ConfigurationClassParser newParser() { 
		return new ConfigurationClassParser( 
				new CachingMetadataReaderFactory(),
				new FailFastProblemReporter(),
				new StandardEnvironment(),
				new DefaultResourceLoader(),
				new AnnotationBeanNameGenerator(),
				new DefaultListableBeanFactory());
	} 
 
	@Override 
	protected String loadAsConfigurationSource(Class<?> clazz) throws Exception {
		return clazz.getName();
	} 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
	/** 
	 * Create a new PortletContextResourceLoader. 
	 * @param portletContext the PortletContext to load resources with 
	 */ 
	public PortletContextResourceLoader(PortletContext portletContext) { 
		this.portletContext = portletContext; 
	} 
 
	/** 
	 * This implementation supports file paths beneath the root of the web application. 
	 * @see PortletContextResource 
	 */ 
	@Override 
	protected Resource getResourceByPath(String path) { 
		return new PortletContextResource(this.portletContext, path); 
	} 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getResource
    private Properties properties;
 
    public String getSecret(String appKey) {
        if (properties == null) {
            try { 
                DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
                Resource resource = resourceLoader.getResource(appSecretFile);
                properties =   PropertiesLoaderUtils.loadProperties(resource);
            } catch (IOException e) {
                throw new RopException("在类路径下找不到rop.appSecret.properties的应用密钥的属性文件", e);
            } 
        } 
        String secret = properties.getProperty(appKey);
 
        if (secret == null) {
            logger.error("不存在应用键为{0}的密钥,请检查应用密钥的配置文件。", appKey);
        } 
        return secret;
    } 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 */ 
public class DataFixtures { 
 
	public static final String DEFAULT_ENCODING = "UTF-8";
 
	private static ResourceLoader resourceLoader = new DefaultResourceLoader();
 
	public static void executeScript(DataSource dataSource, String... sqlResourcePaths) throws DataAccessException,
			SQLException {
		for (String sqlResourcePath : sqlResourcePaths) {
			Resource resource = resourceLoader.getResource(sqlResourcePath);
			ScriptUtils.executeSqlScript(dataSource.getConnection(), new EncodedResource(resource, DEFAULT_ENCODING));
		} 
	} 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
public class SpringTemplateLoaderTest { 
 
  @Test 
  public void sourceAt() throws IOException { 
    SpringTemplateLoader loader = 
        new SpringTemplateLoader(new DefaultResourceLoader()); 
 
    TemplateSource source = loader.sourceAt("template"); 
 
    assertNotNull(source); 
  } 
 
  @Test(expected = IOException.class) 
  public void fileNotFound() throws IOException { 
    new SpringTemplateLoader(new DefaultResourceLoader()).sourceAt("missingFile"); 
  } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
	/** 
	 * Create a new SimpleMetadataReaderFactory for the default class loader. 
	 */ 
	public SimpleMetadataReaderFactory() { 
		this.resourceLoader = new DefaultResourceLoader();
	} 
 
	/** 
	 * Create a new SimpleMetadataReaderFactory for the given resource loader. 
	 * @param resourceLoader the Spring ResourceLoader to use 
	 * (also determines the ClassLoader to use) 
	 */ 
	public SimpleMetadataReaderFactory(ResourceLoader resourceLoader) {
		this.resourceLoader = (resourceLoader != null ? resourceLoader : new DefaultResourceLoader());
	} 
 
	/** 
	 * Create a new SimpleMetadataReaderFactory for the given class loader. 
	 * @param classLoader the ClassLoader to use 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	@Override 
	public void initialize() { 
		if (this.resourceLoader == null) {
			this.resourceLoader = SchedulerFactoryBean.getConfigTimeResourceLoader();
			if (this.resourceLoader == null) {
				this.resourceLoader = new DefaultResourceLoader();
			} 
		} 
	} 
 
	@Override 
	@SuppressWarnings("rawtypes") 
	public Class loadClass(String name) throws ClassNotFoundException {
		return this.resourceLoader.getClassLoader().loadClass(name);
	} 
 
	@SuppressWarnings("unchecked") 
	public <T> Class<? extends T> loadClass(String name, Class<T> clazz) throws ClassNotFoundException {
		return loadClass(name);
	} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getResource
 
	private final ClassRelativeResourceLoader resourceLoader = new ClassRelativeResourceLoader(getClass()); 
 
 
	Resource resource(String path) { 
		return resourceLoader.getResource(path); 
	} 
 
	@Test 
	public void testFactoryBeanLifecycle() throws Exception { 
		EmbeddedDatabaseFactoryBean bean = new EmbeddedDatabaseFactoryBean(); 
		ResourceDatabasePopulator populator = new ResourceDatabasePopulator(resource("db-schema.sql"), 
			resource("db-test-data.sql")); 
		bean.setDatabasePopulator(populator); 
		bean.afterPropertiesSet(); 
		DataSource ds = bean.getObject(); 
		JdbcTemplate template = new JdbcTemplate(ds); 
		assertEquals("Keith", template.queryForObject("select NAME from T_TEST", String.class)); 
		bean.destroy(); 
	} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	/** 
	 * Create a new LocalizedResourceHelper with a DefaultResourceLoader. 
	 * @see org.springframework.core.io.DefaultResourceLoader 
	 */ 
	public LocalizedResourceHelper() { 
		this.resourceLoader = new DefaultResourceLoader();
	} 
 
	/** 
	 * Create a new LocalizedResourceHelper with the given ResourceLoader. 
	 * @param resourceLoader the ResourceLoader to use 
	 */ 
	public LocalizedResourceHelper(ResourceLoader resourceLoader) {
		Assert.notNull(resourceLoader, "ResourceLoader must not be null");
		this.resourceLoader = resourceLoader;
	} 
 
	/** 
	 * Set the separator to use inbetween file name parts. 
	 * Default is an underscore ("_"). 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getResource
	} 
 
	abstract EmbeddedDatabaseType getEmbeddedDatabaseType(); 
 
	Resource resource(String path) { 
		return resourceLoader.getResource(path); 
	} 
 
	Resource defaultSchema() { 
		return resource("db-schema.sql"); 
	} 
 
	Resource usersSchema() { 
		return resource("users-schema.sql"); 
	} 
 
	void assertUsersDatabaseCreated(String... lastNames) { 
		for (String lastName : lastNames) { 
			assertThat("Did not find user with last name [" + lastName + "].", 
				jdbcTemplate.queryForObject("select count(0) from users where last_name = ?", Integer.class, lastName), 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Spring Framework DefaultResourceLoader Methods: