Search in sources :

Example 61 with DefaultResourceLoader

use of org.springframework.core.io.DefaultResourceLoader in project spring-boot by spring-projects.

the class AutoConfigurationImportSelectorTests method setup.

@BeforeEach
void setup() {
    this.importSelector.setBeanFactory(this.beanFactory);
    this.importSelector.setEnvironment(this.environment);
    this.importSelector.setResourceLoader(new DefaultResourceLoader());
}
Also used : DefaultResourceLoader(org.springframework.core.io.DefaultResourceLoader) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 62 with DefaultResourceLoader

use of org.springframework.core.io.DefaultResourceLoader in project spring-boot by spring-projects.

the class ImportAutoConfigurationImportSelectorTests method setup.

@BeforeEach
void setup() {
    this.importSelector.setBeanFactory(this.beanFactory);
    this.importSelector.setEnvironment(this.environment);
    this.importSelector.setResourceLoader(new DefaultResourceLoader());
}
Also used : DefaultResourceLoader(org.springframework.core.io.DefaultResourceLoader) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 63 with DefaultResourceLoader

use of org.springframework.core.io.DefaultResourceLoader in project spring-boot by spring-projects.

the class SpringApplicationTests method customResourceLoaderFromConstructor.

@Test
void customResourceLoaderFromConstructor() {
    ResourceLoader resourceLoader = new DefaultResourceLoader();
    TestSpringApplication application = new TestSpringApplication(resourceLoader, ExampleWebConfig.class);
    this.context = application.run();
    then(application.getLoader()).should().setResourceLoader(resourceLoader);
}
Also used : ResourceLoader(org.springframework.core.io.ResourceLoader) DefaultResourceLoader(org.springframework.core.io.DefaultResourceLoader) DefaultResourceLoader(org.springframework.core.io.DefaultResourceLoader) Test(org.junit.jupiter.api.Test)

Example 64 with DefaultResourceLoader

use of org.springframework.core.io.DefaultResourceLoader in project spring-boot by spring-projects.

the class SpringApplicationTests method customResourceLoader.

@Test
void customResourceLoader() {
    TestSpringApplication application = new TestSpringApplication(ExampleConfig.class);
    application.setWebApplicationType(WebApplicationType.NONE);
    ResourceLoader resourceLoader = new DefaultResourceLoader();
    application.setResourceLoader(resourceLoader);
    this.context = application.run();
    then(application.getLoader()).should().setResourceLoader(resourceLoader);
}
Also used : ResourceLoader(org.springframework.core.io.ResourceLoader) DefaultResourceLoader(org.springframework.core.io.DefaultResourceLoader) DefaultResourceLoader(org.springframework.core.io.DefaultResourceLoader) Test(org.junit.jupiter.api.Test)

Example 65 with DefaultResourceLoader

use of org.springframework.core.io.DefaultResourceLoader in project spring-boot by spring-projects.

the class SpringApplicationBuilderTests method parentContextWithClassLoader.

@Test
void parentContextWithClassLoader() {
    SpringApplicationBuilder application = new SpringApplicationBuilder(ChildConfig.class).contextFactory(ApplicationContextFactory.ofContextClass(SpyApplicationContext.class));
    ClassLoader classLoader = new URLClassLoader(new URL[0], getClass().getClassLoader());
    application.resourceLoader(new DefaultResourceLoader(classLoader));
    application.parent(ExampleConfig.class);
    this.context = application.run();
    assertThat(((SpyApplicationContext) this.context).getResourceLoader().getClassLoader()).isEqualTo(classLoader);
}
Also used : URLClassLoader(java.net.URLClassLoader) URLClassLoader(java.net.URLClassLoader) DefaultResourceLoader(org.springframework.core.io.DefaultResourceLoader) Test(org.junit.jupiter.api.Test)

Aggregations

DefaultResourceLoader (org.springframework.core.io.DefaultResourceLoader)68 Test (org.junit.jupiter.api.Test)28 ResourceLoader (org.springframework.core.io.ResourceLoader)20 Resource (org.springframework.core.io.Resource)10 Before (org.junit.Before)8 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)8 IOException (java.io.IOException)6 BeanDefinition (org.springframework.beans.factory.config.BeanDefinition)6 URLClassLoader (java.net.URLClassLoader)4 Test (org.junit.Test)4 Environment (org.springframework.core.env.Environment)4 InputStream (java.io.InputStream)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 MethodSource (org.junit.jupiter.params.provider.MethodSource)3 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)3 XmlBeanDefinitionReader (org.springframework.beans.factory.xml.XmlBeanDefinitionReader)3 LRUCacheManager (io.syndesis.common.util.cache.LRUCacheManager)2 DataManager (io.syndesis.server.dao.manager.DataManager)2 EncryptionComponent (io.syndesis.server.dao.manager.EncryptionComponent)2 File (java.io.File)2