Merge 3.1.0 development branch into trunk
Branch in question is 'env' branch from git://git.springsource.org/sandbox/cbeams.git; merged into
git-svn repository with:
git merge -s recursive -Xtheirs --no-commit env
No merge conflicts, but did need to
git rm spring-build
prior to committing.
With this change, Spring 3.1.0 development is now happening on SVN
trunk. Further commits to the 3.0.x line will happen in an as-yet
uncreated SVN branch. 3.1.0 snapshots will be available
per the usual nightly CI build from trunk.
This commit is contained in:
@@ -34,6 +34,9 @@ import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.beans.PropertyAccessorFactory;
|
||||
import org.springframework.beans.PropertyValue;
|
||||
import org.springframework.beans.PropertyValues;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.core.env.DefaultWebEnvironment;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceEditor;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
@@ -83,6 +86,11 @@ public abstract class HttpServletBean extends HttpServlet {
|
||||
*/
|
||||
private final Set<String> requiredProperties = new HashSet<String>();
|
||||
|
||||
/**
|
||||
* TODO SPR-7508: think about making this overridable {@link EnvironmentAware}?
|
||||
*/
|
||||
private Environment environment = new DefaultWebEnvironment();
|
||||
|
||||
|
||||
/**
|
||||
* Subclasses can invoke this method to specify that this property
|
||||
@@ -114,7 +122,7 @@ public abstract class HttpServletBean extends HttpServlet {
|
||||
PropertyValues pvs = new ServletConfigPropertyValues(getServletConfig(), this.requiredProperties);
|
||||
BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
|
||||
ResourceLoader resourceLoader = new ServletContextResourceLoader(getServletContext());
|
||||
bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader));
|
||||
bw.registerCustomEditor(Resource.class, new ResourceEditor(resourceLoader, this.environment));
|
||||
initBeanWrapper(bw);
|
||||
bw.setPropertyValues(pvs, true);
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ public class XmlViewResolver extends AbstractCachingViewResolver
|
||||
|
||||
// Load XML resource with context-aware entity resolver.
|
||||
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);
|
||||
reader.setEnvironment(getApplicationContext().getEnvironment());
|
||||
reader.setEntityResolver(new ResourceEntityResolver(getApplicationContext()));
|
||||
reader.loadBeanDefinitions(actualLocation);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user