Package org.springframework.core.io

Examples of org.springframework.core.io.DefaultResourceLoader


            return context;
        } catch (ClassNotFoundException e) {
            // create generic application context
            GenericApplicationContext context = new GenericApplicationContext(parent);
            context.setClassLoader(classLoader);
            ResourceLoader resourceLoader = new DefaultResourceLoader(classLoader);
            context.setResourceLoader(resourceLoader);
            BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
            for (String resource : resources) {
                reader.loadBeanDefinitions(resourceLoader.getResource(resource));
            }
            context.refresh();
            return context;
        }
View Full Code Here


  @Before
  public void setUp() {

    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(SampleConfiguration.class, true);
    environment = new StandardEnvironment();
    resourceLoader = new DefaultResourceLoader();
    source = new AnnotationRepositoryConfigurationSource(annotationMetadata, EnableRepositories.class, resourceLoader,
        environment);
  }
View Full Code Here

   * @see DATACMNS-47
   */
  @Test
  public void evaluatesExcludeFiltersCorrectly() {

    Collection<BeanDefinition> candidates = source.getCandidates(new DefaultResourceLoader());
    assertThat(candidates, hasSize(1));

    BeanDefinition candidate = candidates.iterator().next();
    assertThat(candidate.getBeanClassName(), is(MyRepository.class.getName()));
  }
View Full Code Here

  }

  static class DummyRegistrar extends RepositoryBeanDefinitionRegistrarSupport {

    DummyRegistrar() {
      setResourceLoader(new DefaultResourceLoader());
    }
View Full Code Here

  public static void setupTestData(final DataSource dataSource) throws LiquibaseException {
    log.info("Setting up database for testing");
    SpringLiquibase liquibase = new SpringLiquibase();
    liquibase.setChangeLog("classpath:liquibase.xml");
    liquibase.setDataSource(dataSource);
    liquibase.setResourceLoader(new DefaultResourceLoader());
    liquibase.setDropFirst(true);
    liquibase.afterPropertiesSet();
  }
View Full Code Here

        }
       
        factory.setRepositoryName("jeceira-repo");
        factory.resolveConfigurationResource();
        ConfigManager config = factory.getConfigManager();
        DefaultResourceLoader loader = new DefaultResourceLoader();
        Resource res = loader.getResource("/jeceira.xml");
        assertEquals(res, factory.getConfiguration());
       
        factory = new RepositoryFactoryBean();
        factory.setConfigManager(config);
        factory.setRepositoryName("jeceira-repo");
View Full Code Here

     * resource loader.
     *
     * @param engine The template engine that will be used to generate the appropriate templates.
     */
    protected BasicTemplateResolver(TemplateEngine engine) {
        this(engine, new DefaultResourceLoader());
    }
View Full Code Here

     * Test method for 'org.springmodules.jcr.jeceira.RepositoryFactoryBean.resolveConfigurationResource()'
     */
    public void testResolveConfigurationResource() throws Exception {
      
        factory.resolveConfigurationResource();
        DefaultResourceLoader loader = new DefaultResourceLoader();
        Resource res = loader.getResource("/repository.xml");
        assertEquals(res, factory.getConfiguration());
        assertEquals(".", factory.getHomeDir().getFilename());
       
    }
View Full Code Here

*/
public class GenericWebContextLoader extends AbstractContextLoader {
    protected final MockServletContext servletContext;

    public GenericWebContextLoader(String warRootDir, boolean isClasspathRelative) {
        ResourceLoader resourceLoader = isClasspathRelative ? new DefaultResourceLoader() : new FileSystemResourceLoader();
        this.servletContext = initServletContext(warRootDir, resourceLoader);
    }
View Full Code Here

    protected Resource createResource(Element resourceDefinition) {
        String path = resourceDefinition.getAttribute(LOCATION_ATTR);
        if (!StringUtils.hasText(path)) {
            throw new ValidationConfigurationException("Resoruce path is required and cannot be empty");
        }
        return new DefaultResourceLoader().getResource(path);
    }
View Full Code Here

TOP

Related Classes of org.springframework.core.io.DefaultResourceLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.