Java Code Examples for org.springframework.beans.factory.xml.XmlBeanDefinitionReader#setValidationMode()
The following examples show how to use
org.springframework.beans.factory.xml.XmlBeanDefinitionReader#setValidationMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BeansConfigurationHelper.java From flowable-engine with Apache License 2.0 | 6 votes |
public static AbstractEngineConfiguration parseEngineConfiguration(Resource springResource, String beanName) { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory); xmlBeanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); xmlBeanDefinitionReader.loadBeanDefinitions(springResource); // Check non singleton beans for types // Do not eagerly initialize FactorBeans when getting BeanFactoryPostProcessor beans Collection<BeanFactoryPostProcessor> factoryPostProcessors = beanFactory.getBeansOfType(BeanFactoryPostProcessor.class, true, false).values(); if (factoryPostProcessors.isEmpty()) { factoryPostProcessors = Collections.singleton(new PropertyPlaceholderConfigurer()); } for (BeanFactoryPostProcessor factoryPostProcessor : factoryPostProcessors) { factoryPostProcessor.postProcessBeanFactory(beanFactory); } AbstractEngineConfiguration engineConfiguration = (AbstractEngineConfiguration) beanFactory.getBean(beanName); engineConfiguration.setBeans(new SpringBeanFactoryProxyMap(beanFactory)); return engineConfiguration; }
Example 2
Source File: BeansConfigurationHelper.java From flowable-engine with Apache License 2.0 | 6 votes |
public static ProcessEngineConfiguration parseProcessEngineConfiguration(Resource springResource, String beanName) { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory); xmlBeanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); xmlBeanDefinitionReader.loadBeanDefinitions(springResource); // Check non singleton beans for types // Do not eagerly initialize FactorBeans when getting BeanFactoryPostProcessor beans Collection<BeanFactoryPostProcessor> factoryPostProcessors = beanFactory.getBeansOfType(BeanFactoryPostProcessor.class, true, false).values(); if (factoryPostProcessors.isEmpty()) { factoryPostProcessors = Collections.singleton(new PropertyPlaceholderConfigurer()); } for (BeanFactoryPostProcessor factoryPostProcessor : factoryPostProcessors) { factoryPostProcessor.postProcessBeanFactory(beanFactory); } ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) beanFactory.getBean(beanName); processEngineConfiguration.setBeans(new SpringBeanFactoryProxyMap(beanFactory)); return processEngineConfiguration; }
Example 3
Source File: IgniteSpringHelperImpl.java From ignite with Apache License 2.0 | 6 votes |
/** * Creates Spring application context. Optionally excluded properties can be specified, * it means that if such a property is found in {@link org.apache.ignite.configuration.IgniteConfiguration} * then it is removed before the bean is instantiated. * For example, {@code streamerConfiguration} can be excluded from the configs that Visor uses. * * @param cfgStream Stream where config file is located. * @param excludedProps Properties to be excluded. * @return Spring application context. * @throws IgniteCheckedException If configuration could not be read. */ public static ApplicationContext applicationContext(InputStream cfgStream, final String... excludedProps) throws IgniteCheckedException { try { GenericApplicationContext springCtx = prepareSpringContext(excludedProps); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(springCtx); reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); reader.loadBeanDefinitions(new InputStreamResource(cfgStream)); springCtx.refresh(); return springCtx; } catch (BeansException e) { if (X.hasCause(e, ClassNotFoundException.class)) throw new IgniteCheckedException("Failed to instantiate Spring XML application context " + "(make sure all classes used in Spring configuration are present at CLASSPATH) ", e); else throw new IgniteCheckedException("Failed to instantiate Spring XML application context [err=" + e.getMessage() + ']', e); } }
Example 4
Source File: CustomNamespaceHandlerTests.java From spring-analysis-note with MIT License | 5 votes |
@Before public void setUp() throws Exception { NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS); this.beanFactory = new GenericApplicationContext(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory); reader.setNamespaceHandlerResolver(resolver); reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); reader.setEntityResolver(new DummySchemaResolver()); reader.loadBeanDefinitions(getResource()); this.beanFactory.refresh(); }
Example 5
Source File: CustomNamespaceHandlerTests.java From java-technology-stack with MIT License | 5 votes |
@Before public void setUp() throws Exception { NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS); this.beanFactory = new GenericApplicationContext(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory); reader.setNamespaceHandlerResolver(resolver); reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); reader.setEntityResolver(new DummySchemaResolver()); reader.loadBeanDefinitions(getResource()); this.beanFactory.refresh(); }
Example 6
Source File: FormEngineConfiguration.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public static FormEngineConfiguration parseFormEngineConfiguration(Resource springResource, String beanName) { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory); xmlBeanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); xmlBeanDefinitionReader.loadBeanDefinitions(springResource); FormEngineConfiguration formEngineConfiguration = (FormEngineConfiguration) beanFactory.getBean(beanName); formEngineConfiguration.setBeanFactory(beanFactory); return formEngineConfiguration; }
Example 7
Source File: BeansConfigurationHelper.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public static ProcessEngineConfiguration parseProcessEngineConfiguration(Resource springResource, String beanName) { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory); xmlBeanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); xmlBeanDefinitionReader.loadBeanDefinitions(springResource); ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) beanFactory.getBean(beanName); processEngineConfiguration.setBeans(new SpringBeanFactoryProxyMap(beanFactory)); return processEngineConfiguration; }
Example 8
Source File: BeansConfigurationHelper.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public static ProcessEngineConfiguration parseProcessEngineConfiguration(Resource springResource, String beanName) { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory); xmlBeanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); xmlBeanDefinitionReader.loadBeanDefinitions(springResource); ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) beanFactory.getBean(beanName); processEngineConfiguration.setBeans(new SpringBeanFactoryProxyMap(beanFactory)); return processEngineConfiguration; }
Example 9
Source File: DmnEngineConfiguration.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public static DmnEngineConfiguration parseDmnEngineConfiguration(Resource springResource, String beanName) { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory); xmlBeanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); xmlBeanDefinitionReader.loadBeanDefinitions(springResource); DmnEngineConfiguration processEngineConfiguration = (DmnEngineConfiguration) beanFactory.getBean(beanName); processEngineConfiguration.setBeanFactory(beanFactory); return processEngineConfiguration; }
Example 10
Source File: CustomNamespaceHandlerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS); this.beanFactory = new GenericApplicationContext(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory); reader.setNamespaceHandlerResolver(resolver); reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); reader.setEntityResolver(new DummySchemaResolver()); reader.loadBeanDefinitions(getResource()); this.beanFactory.refresh(); }
Example 11
Source File: BeansConfigurationHelper.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static ProcessEngineConfiguration parseProcessEngineConfiguration(Resource springResource, String beanName) { DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(beanFactory); xmlBeanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD); xmlBeanDefinitionReader.loadBeanDefinitions(springResource); ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) beanFactory.getBean(beanName); if (processEngineConfiguration.getBeans() == null) { processEngineConfiguration.setBeans(new SpringBeanFactoryProxyMap(beanFactory)); } return processEngineConfiguration; }
Example 12
Source File: AutomationEngine.java From JTAF-XCore with Apache License 2.0 | 4 votes |
private AutomationEngine() { try { InputStream fi = getFrameworkFile(); GenericApplicationContext ctx = new GenericApplicationContext(); XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx); xmlReader .setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); xmlReader.loadBeanDefinitions(new InputSource(fi)); ctx.refresh(); this.pluginManager = (PluginManager) ctx.getBean("PluginManager"); digraph = new TestDigraph( new ClassBasedEdgeFactory<DiNode, DiEdge>(DiEdge.class)); commandlibParser = new CommandLibraryParser(); scriptParser = new ScriptParser(); scriptParser.setDigraph(digraph); commandlibParser .setAutomationClassLoader(new DefaultAutomationClassLoader()); testStrategyParser = new TestStrategyParser(); testStrategyParser.setDigraph(digraph); initPostParseStrategyElementPlugins(); testRoot = null; this.interpreter = (Interpreter) ctx.getBean("Interpreter"); this.interpreter.setCommandRunnerPlugins(pluginManager .getCommandRunnerPlugins()); this.interpreter.setTestRunnerPlugins(pluginManager .getTestRunnerPlugins()); this.interpreter.setTearDownPlugins(pluginManager.getTearDownPlugins()); initPostParseAllPlugins(); initPostParseSuitePlugins(); initPostParseTestPlugins(); } catch (Exception e) { // If something goes wrong here, we have a serious issue logger.fatal(e); throw new RuntimeException(e); } }