Search in sources :

Example 66 with ClassPathXmlApplicationContext

use of org.springframework.context.support.ClassPathXmlApplicationContext in project OpenMEAP by OpenMEAP.

the class ModelTestUtils method main.

/**
	 * I used this mainly to generate the DDL.
	 * @param argv
	 */
public static void main(String[] argv) {
    //getPersistenceBean("modelManager");
    if (persistenceBeans == null) {
        System.setProperty("hibernate.show_sql", "true");
        System.setProperty("hibernate.hbm2ddl.auto", "update");
        System.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
        System.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
        System.setProperty("hibernate.connection.url", "jdbc:mysql://localhost:3306/openmeap");
        System.setProperty("hibernate.connection.username", "openmeap");
        System.setProperty("hibernate.connection.password", "password");
        persistenceBeans = new ClassPathXmlApplicationContext(new String[] { "/META-INF/persistenceContext.xml", "/META-INF/test/persistenceContext.xml" });
    }
    createModel(null);
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Example 67 with ClassPathXmlApplicationContext

use of org.springframework.context.support.ClassPathXmlApplicationContext in project jersey by jersey.

the class Aspect4JTest method configure.

@Override
protected Application configure() {
    applicationContext = new ClassPathXmlApplicationContext("jersey-spring-aspect4j-applicationContext.xml");
    testAspect = applicationContext.getBean(TestAspect.class);
    return new Aspect4jJerseyConfig().property("contextConfig", applicationContext);
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Example 68 with ClassPathXmlApplicationContext

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

the class LambdaIT method test.

@Test
public void test() throws Exception {
    ApplicationContext context = new ClassPathXmlApplicationContext("lambda-test.xml");
    Maru maru = context.getBean(Maru.class);
    Morae morae = context.getBean(Morae.class);
    maru.test(morae);
    PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
    verifier.printCache();
    verifier.verifyTrace(Expectations.event("SPRING_BEAN", Maru.class.getMethod("test", Morae.class)));
    verifier.verifyTrace(Expectations.event("SPRING_BEAN", Morae.class.getMethod("test", Predicate.class)));
    verifier.verifyTrace(Expectations.event("SPRING_BEAN", Mozzi.class.getMethod("getAge")));
    verifier.verifyTraceCount(0);
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) PluginTestVerifier(com.navercorp.pinpoint.bootstrap.plugin.test.PluginTestVerifier) Test(org.junit.Test)

Example 69 with ClassPathXmlApplicationContext

use of org.springframework.context.support.ClassPathXmlApplicationContext in project cucumber-jvm by cucumber.

the class CucumberTestContextManager method createFallbackContext.

@SuppressWarnings("resource")
private ConfigurableListableBeanFactory createFallbackContext() {
    ConfigurableApplicationContext applicationContext;
    if (getClass().getClassLoader().getResource("cucumber.xml") != null) {
        applicationContext = new ClassPathXmlApplicationContext("cucumber.xml");
    } else {
        applicationContext = new GenericApplicationContext();
    }
    applicationContext.registerShutdownHook();
    ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory();
    beanFactory.registerScope(GlueCodeScope.NAME, new GlueCodeScope());
    for (Class<?> stepClass : stepClasses) {
        registerStepClassBeanDefinition(beanFactory, stepClass);
    }
    return beanFactory;
}
Also used : ConfigurableApplicationContext(org.springframework.context.ConfigurableApplicationContext) GenericApplicationContext(org.springframework.context.support.GenericApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ConfigurableListableBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)

Example 70 with ClassPathXmlApplicationContext

use of org.springframework.context.support.ClassPathXmlApplicationContext in project useful-java-links by Vedenin.

the class XmlFieldAutowired method main.

public static void main(String[] args) throws Exception {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("fieldAutowired.xml");
    Notifier notifier = context.getBean(Notifier.class);
    // Print "I send email: Hello world!"
    notifier.send("Hello world!");
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext)

Aggregations

ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)561 Test (org.junit.Test)265 ApplicationContext (org.springframework.context.ApplicationContext)167 Before (org.junit.Before)53 ConfigurableMessenger (org.springframework.scripting.ConfigurableMessenger)33 ITestBean (org.springframework.tests.sample.beans.ITestBean)30 Messenger (org.springframework.scripting.Messenger)29 CamelContext (org.apache.camel.CamelContext)25 Refreshable (org.springframework.aop.target.dynamic.Refreshable)23 AbstractXmlApplicationContext (org.springframework.context.support.AbstractXmlApplicationContext)22 DataSource (javax.sql.DataSource)18 SpringCamelContext (org.apache.camel.spring.SpringCamelContext)16 AbstractApplicationContext (org.springframework.context.support.AbstractApplicationContext)16 Bus (org.apache.cxf.Bus)14 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)14 ArrayList (java.util.ArrayList)13 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)12 DemoService (com.alibaba.dubbo.config.spring.api.DemoService)11 IOException (java.io.IOException)10 ProducerTemplate (org.apache.camel.ProducerTemplate)10