added setValidating method to AbstractXmlApplicationContext, analogous to GenericXmlApplicationContext
This commit is contained in:
parent
0832334648
commit
1c839dbe9c
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2008 the original author or authors.
|
* Copyright 2002-2009 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -44,6 +44,9 @@ import org.springframework.core.io.Resource;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableConfigApplicationContext {
|
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableConfigApplicationContext {
|
||||||
|
|
||||||
|
private boolean validating = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new AbstractXmlApplicationContext with no parent.
|
* Create a new AbstractXmlApplicationContext with no parent.
|
||||||
*/
|
*/
|
||||||
|
|
@ -59,6 +62,14 @@ public abstract class AbstractXmlApplicationContext extends AbstractRefreshableC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether to use XML validation. Default is <code>true</code>.
|
||||||
|
*/
|
||||||
|
public void setValidating(boolean validating) {
|
||||||
|
this.validating = validating;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the bean definitions via an XmlBeanDefinitionReader.
|
* Loads the bean definitions via an XmlBeanDefinitionReader.
|
||||||
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader
|
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader
|
||||||
|
|
@ -90,6 +101,9 @@ public abstract class AbstractXmlApplicationContext extends AbstractRefreshableC
|
||||||
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader#setDocumentReaderClass
|
* @see org.springframework.beans.factory.xml.XmlBeanDefinitionReader#setDocumentReaderClass
|
||||||
*/
|
*/
|
||||||
protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
|
protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
|
||||||
|
beanDefinitionReader.setValidationMode(this.validating ?
|
||||||
|
XmlBeanDefinitionReader.VALIDATION_AUTO : XmlBeanDefinitionReader.VALIDATION_NONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ public class GenericXmlApplicationContext extends GenericApplicationContext {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether to use XML validation.
|
* Set whether to use XML validation. Default is <code>true</code>.
|
||||||
*/
|
*/
|
||||||
public void setValidating(boolean validating) {
|
public void setValidating(boolean validating) {
|
||||||
this.reader.setValidationMode(validating ?
|
this.reader.setValidationMode(validating ?
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue