From 8770ea96b03106a06ee7ce401dc2fe39f419f816 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Wed, 8 Dec 2010 07:59:41 +0000 Subject: [PATCH] Expose Environment ConfigurationService AbstractEnvironment delegates to an underlying ConfigurationService when processing methods such as getProperty(String name, Class targetType) Accessor methods have been added to the ConfigurableEnvironment interface that allow this service to be updated or replaced. --- .../org/springframework/core/env/AbstractEnvironment.java | 6 ++++++ .../springframework/core/env/ConfigurableEnvironment.java | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java b/org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java index e58fd3e961..1acc25c866 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java +++ b/org.springframework.core/src/main/java/org/springframework/core/env/AbstractEnvironment.java @@ -69,7 +69,13 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment { new PropertyPlaceholderHelper(PLACEHOLDER_PREFIX, PLACEHOLDER_SUFFIX, VALUE_SEPARATOR, false); + public ConversionService getConversionService() { + return this.conversionService; + } + public void setConversionService(ConversionService conversionService) { + this.conversionService = conversionService; + } public void addPropertySource(PropertySource propertySource) { propertySources.push(propertySource); diff --git a/org.springframework.core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java b/org.springframework.core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java index ea88622ced..85fe51c4f9 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java +++ b/org.springframework.core/src/main/java/org/springframework/core/env/ConfigurableEnvironment.java @@ -16,6 +16,8 @@ package org.springframework.core.env; +import org.springframework.core.convert.ConversionService; + /** * TODO SPR-7508: document * @@ -34,4 +36,7 @@ public interface ConfigurableEnvironment extends Environment, PropertySourceAggr */ void setDefaultProfiles(String... profiles); + public ConversionService getConversionService(); + + public void setConversionService(ConversionService conversionService); }