1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.context;
17
18 import java.util.Properties;
19
20 import org.kuali.rice.core.api.config.property.ConfigContext;
21 import org.kuali.rice.core.impl.config.property.JAXBConfigImpl;
22 import org.springframework.context.support.ClassPathXmlApplicationContext;
23
24 public class SpringContextForBatchRunner {
25 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(SpringContextForBatchRunner.class);
26
27 private static ClassPathXmlApplicationContext context;
28
29 public static void initializeKfs() {
30 long startInit = System.currentTimeMillis();
31 LOG.info("Initializing Kuali Rice Application...");
32
33 String bootstrapSpringBeans = "ole-startup.xml";
34
35 Properties baseProps = new Properties();
36 baseProps.putAll(System.getProperties());
37 JAXBConfigImpl config = new JAXBConfigImpl(baseProps);
38 ConfigContext.init(config);
39
40 context = new ClassPathXmlApplicationContext(bootstrapSpringBeans);
41
42 context.start();
43 long endInit = System.currentTimeMillis();
44 LOG.info("...Kuali Rice Application successfully initialized, startup took " + (endInit - startInit) + " ms.");
45 SpringContext.finishInitializationAfterRiceStartup();
46
47 SpringContext.initMemoryMonitor();
48 SpringContext.initMonitoringThread();
49 }
50
51 }