use of org.springframework.context.support.ClassPathXmlApplicationContext in project sharding-jdbc by dangdangdotcom.
the class Main method main.
public static void main(final String[] args) {
// CHECKSTYLE:ON
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("META-INF/mybatisContext.xml");
OrderService orderService = applicationContext.getBean(OrderService.class);
orderService.clear();
orderService.fooService();
orderService.select();
//[order_id: , user_id: 10, status: UPDATED, order_id: , user_id: 11, status: UPDATED]
orderService.clear();
try {
orderService.fooServiceWithFailure();
} catch (final IllegalArgumentException e) {
System.out.println("roll back");
}
//[]
orderService.select();
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project cradle by BingLau7.
the class Main method xmlLoadBean.
public static void xmlLoadBean() {
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "services.xml" });
// TestBean testBean = context.getBean("testBean", TestBean.class);
// System.out.println(testBean);
TestStaticFactoryBean testStaticFactoryBean = context.getBean("testStaticFactoryBean", TestStaticFactoryBean.class);
System.out.println(testStaticFactoryBean);
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project Asqatasun by Asqatasun.
the class AbstractRuleImplementationTestCase method initialize.
private void initialize() {
initializePath();
// fully loaded, and the test spend at least 200ms for nothing
if (APPLICATION_CONTEXT == null) {
APPLICATION_CONTEXT = new ClassPathXmlApplicationContext(applicationContextFilePath);
WEB_RESOURCE_FACTORY = (WebResourceFactory) APPLICATION_CONTEXT.getBean("webResourceFactory");
CONTENT_FACTORY = (ContentFactory) APPLICATION_CONTEXT.getBean("contentFactory");
PARAMETER_FACTORY = (ParameterFactory) APPLICATION_CONTEXT.getBean("parameterFactory");
PARAMETER_ELEMENT_FACTORY = (ParameterElementFactory) APPLICATION_CONTEXT.getBean("parameterElementFactory");
PARAMETER_FAMILY_FACTORY = (ParameterFamilyFactory) APPLICATION_CONTEXT.getBean("parameterFamilyFactory");
AUDIT_FACTORY = (AuditFactory) APPLICATION_CONTEXT.getBean("auditFactory");
TEST_FACTORY = (TestFactory) APPLICATION_CONTEXT.getBean("testFactory");
CONTENT_LOADER_SERVICE = (ContentLoaderService) APPLICATION_CONTEXT.getBean("contentLoaderService");
CONTENT_ADAPTER_SERVICE = (ContentAdapterService) APPLICATION_CONTEXT.getBean("contentAdapterService");
PROCESSOR_SERVICE = (ProcessorService) APPLICATION_CONTEXT.getBean("processorService");
CONSOLIDATOR_SERVICE = (ConsolidatorService) APPLICATION_CONTEXT.getBean("consolidatorService");
URL_IDENTIFIER = ((URLIdentifierFactory) APPLICATION_CONTEXT.getBean("urlIdentifierFactory")).create();
if (upperCaseTags) {
HTMLCleanerFactoryImpl htmlCleanerFactory = (HTMLCleanerFactoryImpl) APPLICATION_CONTEXT.getBean("htmlCleanerFactory");
htmlCleanerFactory.setRemoveLowerCaseTags(upperCaseTags);
}
}
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project perun by CESNET.
the class DispatcherStarter method main.
/**
* Initialize stand-alone dispatcher.
*
* @param arg
*/
public static void main(String[] arg) {
DispatcherStarter starter = new DispatcherStarter();
starter.springCtx = new ClassPathXmlApplicationContext("perun-core.xml", "perun-dispatcher.xml", "perun-dispatcher-scheduler.xml");
// no need to call init explicitly, gets called by spring when initializing this bean
}
use of org.springframework.context.support.ClassPathXmlApplicationContext in project Dempsy by Dempsy.
the class TestAllClusterImpls method runAllCombinations.
private <T, N> void runAllCombinations(Checker checker) throws Throwable {
for (String clusterManager : clusterManagers) {
ClassPathXmlApplicationContext actx = new ClassPathXmlApplicationContext(clusterManager);
actx.registerShutdownHook();
ClusterInfoSessionFactory factory = (ClusterInfoSessionFactory) actx.getBean("clusterSessionFactory");
if (checker != null)
checker.check("pass for:" + clusterManager, factory);
actx.stop();
actx.destroy();
}
}
Aggregations