List of usage examples for org.springframework.beans.factory.xml XmlBeanDefinitionReader VALIDATION_NONE
int VALIDATION_NONE
To view the source code for org.springframework.beans.factory.xml XmlBeanDefinitionReader VALIDATION_NONE.
Click Source Link
From source file:org.nekorp.workflow.backend.optimization.CustomXmlWebApplicationContext.java
protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) { super.initBeanDefinitionReader(beanDefinitionReader); if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) { beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); beanDefinitionReader.setNamespaceAware(true); }//from w ww .ja v a2 s . c o m }
From source file:org.nebulaframework.util.spring.NebulaApplicationContext.java
/** * Initialize the bean definition reader used for loading the bean * definitions of this context, and disabled XSD Validation to speed up the * context start up time.//from ww w. j ava2s. c om */ @Override protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) { beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); beanDefinitionReader.setNamespaceAware(true); }
From source file:org.lexevs.tree.service.ApplicationContextFactory.java
/** * Instantiates a new application context factory. *//*from w w w .j a v a 2 s. c om*/ protected ApplicationContextFactory() { GenericApplicationContext ctx = new GenericApplicationContext(); ctx.setClassLoader(MyClassLoader.instance()); XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx); xmlReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); InputStream stream = MyClassLoader.instance().getResourceAsStream("treeServiceContext.xml"); xmlReader.loadBeanDefinitions(new InputStreamResource(stream)); ctx.refresh(); this.context = ctx; }
From source file:com.opengamma.engine.calcnode.CalculationNodeProcess.java
private static boolean startContext(final String configuration) { try {/* w ww .j a v a2 s.c o m*/ final GenericApplicationContext context = new GenericApplicationContext(); final XmlBeanDefinitionReader beanReader = new XmlBeanDefinitionReader(context); beanReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); s_logger.debug("Loading configuration"); beanReader.loadBeanDefinitions(new InputSource(new StringReader(configuration))); s_logger.debug("Instantiating beans"); context.refresh(); s_logger.debug("Starting node"); context.start(); return true; } catch (RuntimeException e) { s_logger.warn("Spring initialisation error", e); return false; } }
From source file:org.solmix.runtime.support.spring.TunedDocumentLoader.java
@Override public Document loadDocument(InputSource inputSource, EntityResolver entityResolver, ErrorHandler errorHandler, int validationMode, boolean namespaceAware) throws Exception { if (validationMode == XmlBeanDefinitionReader.VALIDATION_NONE) { SAXParserFactory parserFactory = namespaceAware ? nsasaxParserFactory : saxParserFactory; SAXParser parser = parserFactory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setEntityResolver(entityResolver); reader.setErrorHandler(errorHandler); // SAXSource saxSource = new SAXSource(reader, inputSource); // W3CDOMStreamWriter writer = new W3CDOMStreaXMLStreamWriterImplmWriter(); // StaxUtils.copy(saxSource, writer); // return writer.getDocument(); return null; } else {/* w w w. j a va 2 s.c o m*/ return super.loadDocument(inputSource, entityResolver, errorHandler, validationMode, namespaceAware); } }
From source file:org.finra.jtaf.core.AutomationEngine.java
private AutomationEngine() { try {//ww w.ja v a 2 s. c o m 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()); initPostParseAllPlugins(); initPostParseSuitePlugins(); initPostParseTestPlugins(); } catch (Exception e) { // If something goes wrong here, we have a serious issue logger.fatal(e); throw new RuntimeException(e); } }
From source file:com.safi.asterisk.handler.SafletEngine.java
public static void main(String[] args) throws Exception { System.out.println("OS Name: " + OS_NAME); ApplicationContext context = new ClassPathXmlApplicationContext(CONTEXT_CONFIG_LOCATION) { @Override//from ww w . j a va2 s . c o m protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) { beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); super.initBeanDefinitionReader(beanDefinitionReader); } }; SafletEngine engine = (SafletEngine) context.getBean("handlerEngine"); SafletEngine.instance = engine; engine.startupTime = System.currentTimeMillis(); try { engine.setApplicationContext(context); engine.init(); engine.beginProcessing(); } finally { // engine.stopProcessing(); } }
From source file:org.impalaframework.util.XMLDomUtils.java
public static Document loadDocument(Reader reader, String description) { Document document = null;/*w ww.j ava2s . c o m*/ DefaultDocumentLoader loader = new DefaultDocumentLoader(); try { InputSource inputSource = new InputSource(reader); document = loader.loadDocument(inputSource, null, new SimpleSaxErrorHandler(logger), XmlBeanDefinitionReader.VALIDATION_NONE, true); } catch (Exception e) { throw new ExecutionException("Unable to load XML document from resource " + description, e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { } } return document; }
From source file:org.springframework.beans.factory.xml.XmlBeanFactoryTests.java
@Test public void testRefToSeparatePrototypeInstances() throws Exception { DefaultListableBeanFactory xbf = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf); reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); reader.loadBeanDefinitions(REFTYPES_CONTEXT); TestBean emma = (TestBean) xbf.getBean("emma"); TestBean georgia = (TestBean) xbf.getBean("georgia"); ITestBean emmasJenks = emma.getSpouse(); ITestBean georgiasJenks = georgia.getSpouse(); assertTrue("Emma and georgia think they have a different boyfriend", emmasJenks != georgiasJenks); assertTrue("Emmas jenks has right name", emmasJenks.getName().equals("Andrew")); assertTrue("Emmas doesn't equal new ref", emmasJenks != xbf.getBean("jenks")); assertTrue("Georgias jenks has right name", emmasJenks.getName().equals("Andrew")); assertTrue("They are object equal", emmasJenks.equals(georgiasJenks)); assertTrue("They object equal direct ref", emmasJenks.equals(xbf.getBean("jenks"))); }
From source file:org.springframework.beans.factory.xml.XmlBeanFactoryTests.java
@Test public void testRefToSingleton() throws Exception { DefaultListableBeanFactory xbf = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(xbf); reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE); reader.loadBeanDefinitions(new EncodedResource(REFTYPES_CONTEXT, "ISO-8859-1")); TestBean jen = (TestBean) xbf.getBean("jenny"); TestBean dave = (TestBean) xbf.getBean("david"); TestBean jenks = (TestBean) xbf.getBean("jenks"); ITestBean davesJen = dave.getSpouse(); ITestBean jenksJen = jenks.getSpouse(); assertTrue("1 jen instance", davesJen == jenksJen); assertTrue("1 jen instance", davesJen == jen); }