use of org.springframework.core.io.DefaultResourceLoader in project spring-framework by spring-projects.
the class ClassPathScanningCandidateComponentProviderTests method defaultsWithScan.
@Test
public void defaultsWithScan() {
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
provider.setResourceLoader(new DefaultResourceLoader(CandidateComponentsTestClassLoader.disableIndex(getClass().getClassLoader())));
testDefault(provider, ScannedGenericBeanDefinition.class);
}
use of org.springframework.core.io.DefaultResourceLoader in project spring-framework by spring-projects.
the class DefaultPersistenceUnitManagerTests method defaultDomainWithIndex.
@Test
public void defaultDomainWithIndex() {
this.manager.setPackagesToScan("org.springframework.orm.jpa.domain");
this.manager.setResourceLoader(new DefaultResourceLoader(CandidateComponentsTestClassLoader.index(getClass().getClassLoader(), new ClassPathResource("spring.components", Person.class))));
testDefaultDomain();
}
use of org.springframework.core.io.DefaultResourceLoader in project spring-boot by spring-projects.
the class EnableAutoConfigurationImportSelectorTests method setup.
@Before
public void setup() {
this.importSelector.setBeanFactory(this.beanFactory);
this.importSelector.setEnvironment(this.environment);
this.importSelector.setResourceLoader(new DefaultResourceLoader());
}
use of org.springframework.core.io.DefaultResourceLoader in project spring-boot by spring-projects.
the class DataSourceInitializerTests method multipleScriptsAppliedInLexicalOrder.
@Test
public void multipleScriptsAppliedInLexicalOrder() throws Exception {
EnvironmentTestUtils.addEnvironment(this.context, "spring.datasource.initialize:true", "spring.datasource.schema:" + ClassUtils.addResourcePathToPackagePath(getClass(), "lexical-schema-*.sql"), "spring.datasource.data:" + ClassUtils.addResourcePathToPackagePath(getClass(), "data.sql"));
this.context.register(DataSourceAutoConfiguration.class, PropertyPlaceholderAutoConfiguration.class);
ReverseOrderResourceLoader resourceLoader = new ReverseOrderResourceLoader(new DefaultResourceLoader());
this.context.setResourceLoader(resourceLoader);
this.context.refresh();
DataSource dataSource = this.context.getBean(DataSource.class);
assertThat(dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource).isTrue();
assertThat(dataSource).isNotNull();
JdbcOperations template = new JdbcTemplate(dataSource);
assertThat(template.queryForObject("SELECT COUNT(*) from FOO", Integer.class)).isEqualTo(1);
}
use of org.springframework.core.io.DefaultResourceLoader in project spring-framework by spring-projects.
the class FreeMarkerConfigurerTests method freeMarkerConfigurationAsBean.
// SPR-12448
@Test
public void freeMarkerConfigurationAsBean() {
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
RootBeanDefinition loaderDef = new RootBeanDefinition(SpringTemplateLoader.class);
loaderDef.getConstructorArgumentValues().addGenericArgumentValue(new DefaultResourceLoader());
loaderDef.getConstructorArgumentValues().addGenericArgumentValue("/freemarker");
RootBeanDefinition configDef = new RootBeanDefinition(Configuration.class);
configDef.getPropertyValues().add("templateLoader", loaderDef);
beanFactory.registerBeanDefinition("freeMarkerConfig", configDef);
beanFactory.getBean(Configuration.class);
}
Aggregations