1 10 11 package org.mule.extras.spring.config; 12 13 import java.io.IOException ; 14 15 import org.springframework.beans.BeansException; 16 import org.springframework.beans.factory.support.DefaultListableBeanFactory; 17 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; 18 import org.springframework.context.support.AbstractXmlApplicationContext; 19 20 27 public class MuleApplicationContext extends AbstractXmlApplicationContext 28 { 29 private final String [] configLocations; 30 31 public MuleApplicationContext(String configLocation) 32 { 33 this(new String []{configLocation}); 34 } 35 36 public MuleApplicationContext(String [] configLocations) 37 { 38 this(configLocations, true); 39 } 40 41 public MuleApplicationContext(String [] configLocations, boolean refresh) throws BeansException 42 { 43 this.configLocations = configLocations; 44 if (refresh) 45 { 46 refresh(); 47 } 48 } 49 50 protected String [] getConfigLocations() 51 { 52 return configLocations; 53 } 54 55 protected void initBeanDefinitionReader(XmlBeanDefinitionReader xmlBeanDefinitionReader) 56 { 57 super.initBeanDefinitionReader(xmlBeanDefinitionReader); 58 } 59 60 protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException 61 { 62 XmlBeanDefinitionReader beanDefinitionReader = new MuleBeanDefinitionReader(beanFactory, 63 configLocations.length); 64 initBeanDefinitionReader(beanDefinitionReader); 65 loadBeanDefinitions(beanDefinitionReader); 66 } 67 } 68 | Popular Tags |