Search in sources :

Example 51 with GenericXmlApplicationContext

use of org.springframework.context.support.GenericXmlApplicationContext in project BroadleafCommerce by BroadleafCommerce.

the class EntityConfiguration method configureMergedItems.

@PostConstruct
public void configureMergedItems() {
    Set<Resource> temp = new LinkedHashSet<Resource>();
    if (mergedEntityContexts != null && !mergedEntityContexts.isEmpty()) {
        for (String location : mergedEntityContexts) {
            temp.add(webApplicationContext.getResource(location));
        }
    }
    if (entityContexts != null) {
        for (Resource resource : entityContexts) {
            temp.add(resource);
        }
    }
    entityContexts = temp.toArray(new Resource[temp.size()]);
    applicationcontext = new GenericXmlApplicationContext(entityContexts);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Resource(org.springframework.core.io.Resource) GenericXmlApplicationContext(org.springframework.context.support.GenericXmlApplicationContext) PostConstruct(javax.annotation.PostConstruct)

Example 52 with GenericXmlApplicationContext

use of org.springframework.context.support.GenericXmlApplicationContext in project spring-security by spring-projects.

the class Sec2499Tests method methodExpressionHandlerInParentContextLoads.

@Test
public void methodExpressionHandlerInParentContextLoads() {
    this.parent = new GenericXmlApplicationContext("org/springframework/security/config/method/sec2499/parent.xml");
    this.child = new GenericXmlApplicationContext();
    this.child.load("org/springframework/security/config/method/sec2499/child.xml");
    this.child.setParent(this.parent);
    this.child.refresh();
}
Also used : GenericXmlApplicationContext(org.springframework.context.support.GenericXmlApplicationContext) Test(org.junit.jupiter.api.Test)

Example 53 with GenericXmlApplicationContext

use of org.springframework.context.support.GenericXmlApplicationContext in project pinpoint by naver.

the class AlarmJobTest method main.

public static void main(String[] args) throws Exception {
    GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext("/applicationContext-test.xml");
    JobLauncherTestUtils testLauncher = applicationContext.getBean(JobLauncherTestUtils.class);
    JobExecution jobExecution = testLauncher.launchJob(getParameters());
    BatchStatus status = jobExecution.getStatus();
    assertEquals(BatchStatus.COMPLETED, status);
    applicationContext.close();
}
Also used : JobExecution(org.springframework.batch.core.JobExecution) BatchStatus(org.springframework.batch.core.BatchStatus) JobLauncherTestUtils(org.springframework.batch.test.JobLauncherTestUtils) GenericXmlApplicationContext(org.springframework.context.support.GenericXmlApplicationContext)

Example 54 with GenericXmlApplicationContext

use of org.springframework.context.support.GenericXmlApplicationContext in project midpoint by Evolveum.

the class NinjaContext method setupRepositoryViaMidPointHome.

private void setupRepositoryViaMidPointHome(ConnectionOptions options) {
    boolean connectRepo = !options.isOffline();
    log.info("Initializing using midpoint home; {} repository connection", connectRepo ? "with" : "WITHOUT");
    System.setProperty(MidpointConfiguration.MIDPOINT_SILENT_PROPERTY, "true");
    String midpointHome = options.getMidpointHome();
    System.setProperty(MidpointConfiguration.MIDPOINT_HOME_PROPERTY, midpointHome);
    overrideRepoConfiguration(options);
    GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
    ctx.load(CTX_NINJA);
    ctx.load(connectRepo ? CTX_MIDPOINT : CTX_MIDPOINT_NO_REPO);
    ctx.refresh();
    context = ctx;
    midpointConfiguration = context.getBean(MidpointConfiguration.class);
    repository = connectRepo ? context.getBean(REPOSITORY_SERVICE_BEAN, RepositoryService.class) : null;
    auditService = connectRepo ? context.getBean(AUDIT_SERVICE_BEAN, AuditService.class) : null;
}
Also used : MidpointConfiguration(com.evolveum.midpoint.common.configuration.api.MidpointConfiguration) GenericXmlApplicationContext(org.springframework.context.support.GenericXmlApplicationContext)

Example 55 with GenericXmlApplicationContext

use of org.springframework.context.support.GenericXmlApplicationContext in project spring-framework by spring-projects.

the class JCacheNamespaceDrivenTests method cacheResolver.

@Test
public void cacheResolver() {
    ConfigurableApplicationContext context = new GenericXmlApplicationContext("/org/springframework/cache/jcache/config/jCacheNamespaceDriven-resolver.xml");
    DefaultJCacheOperationSource ci = context.getBean(DefaultJCacheOperationSource.class);
    assertThat(ci.getCacheResolver()).isSameAs(context.getBean("cacheResolver"));
    context.close();
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) DefaultJCacheOperationSource(org.springframework.cache.jcache.interceptor.DefaultJCacheOperationSource) GenericXmlApplicationContext(org.springframework.context.support.GenericXmlApplicationContext) Test(org.junit.jupiter.api.Test)

Aggregations

GenericXmlApplicationContext (org.springframework.context.support.GenericXmlApplicationContext)61 Test (org.junit.Test)21 Test (org.junit.jupiter.api.Test)13 MBeanServer (javax.management.MBeanServer)5 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)5 Scanner (java.util.Scanner)4 ObjectName (javax.management.ObjectName)4 Resource (org.springframework.core.io.Resource)4 QueueChannel (org.springframework.integration.channel.QueueChannel)4 MessageChannel (org.springframework.messaging.MessageChannel)4 ApplicationContext (org.springframework.context.ApplicationContext)3 ByteArrayResource (org.springframework.core.io.ByteArrayResource)3 Message (org.springframework.messaging.Message)3 MBeanOperationInfo (javax.management.MBeanOperationInfo)2 Server (org.eclipse.jetty.server.Server)2 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)2 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)2 BatchStatus (org.springframework.batch.core.BatchStatus)2 BeanDefinitionParsingException (org.springframework.beans.factory.parsing.BeanDefinitionParsingException)2 CacheInterceptor (org.springframework.cache.interceptor.CacheInterceptor)2