use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project spring-data-mongodb by spring-projects.
the class MappingMongoConverterParserValidationIntegrationTests method setUp.
@Before
public void setUp() {
factory = new DefaultListableBeanFactory();
reader = new XmlBeanDefinitionReader(factory);
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project cxf by apache.
the class EndpointCreationLoop2 method readBeans.
private void readBeans(Resource beanResource) {
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(applicationContext);
reader.loadBeanDefinitions(beanResource);
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project engine by craftercms.
the class SiteContextFactory method getApplicationContext.
protected ConfigurableApplicationContext getApplicationContext(SiteContext siteContext, URLClassLoader classLoader, HierarchicalConfiguration config, String[] applicationContextPaths, ResourceLoader resourceLoader) {
try {
List<Resource> resources = new ArrayList<>();
for (String path : applicationContextPaths) {
Resource resource = resourceLoader.getResource(path);
if (resource.exists()) {
resources.add(resource);
}
}
if (CollectionUtils.isNotEmpty(resources)) {
String siteName = siteContext.getSiteName();
logger.info("--------------------------------------------------");
logger.info("<Loading application context for site: " + siteName + ">");
logger.info("--------------------------------------------------");
GenericApplicationContext appContext = new GenericApplicationContext(globalApplicationContext);
appContext.setClassLoader(classLoader);
if (config != null) {
MutablePropertySources propertySources = appContext.getEnvironment().getPropertySources();
propertySources.addFirst(new ApacheCommonsConfiguration2PropertySource("siteConfig", config));
}
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(appContext);
reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
for (Resource resource : resources) {
reader.loadBeanDefinitions(resource);
}
appContext.refresh();
logger.info("--------------------------------------------------");
logger.info("</Loading application context for site: " + siteName + ">");
logger.info("--------------------------------------------------");
return appContext;
} else {
return null;
}
} catch (Exception e) {
throw new SiteContextCreationException("Unable to load application context for site '" + siteContext.getSiteName() + "'", e);
}
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project cxf by apache.
the class EngineLifecycleTest method readBeans.
private void readBeans(Resource beanResource) {
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(applicationContext);
reader.loadBeanDefinitions(beanResource);
}
use of org.springframework.beans.factory.xml.XmlBeanDefinitionReader in project jetty.project by eclipse.
the class SpringConfigurationProcessor method init.
@Override
public void init(URL url, XmlParser.Node config, XmlConfiguration configuration) {
try {
_configuration = configuration;
Resource resource = url != null ? new UrlResource(url) : new ByteArrayResource(("" + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<!DOCTYPE beans PUBLIC \"-//SPRING//DTD BEAN//EN\" \"http://www.springframework.org/dtd/spring-beans.dtd\">" + config).getBytes(StandardCharsets.UTF_8));
_beanFactory = new DefaultListableBeanFactory() {
@Override
protected void applyPropertyValues(String beanName, BeanDefinition mbd, BeanWrapper bw, PropertyValues pvs) {
_configuration.initializeDefaults(bw.getWrappedInstance());
super.applyPropertyValues(beanName, mbd, bw, pvs);
}
};
new XmlBeanDefinitionReader(_beanFactory).loadBeanDefinitions(resource);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations