Merge branch '1.1.x'

pull/1593/head
Dave Syer 10 years ago
commit b06d10ddb0

@ -77,6 +77,11 @@ class OnWebApplicationCondition extends SpringBootCondition {
.match("found web application StandardServletEnvironment");
}
if (context.getResourceLoader() instanceof WebApplicationContext) {
return ConditionOutcome
.match("found web application WebApplicationContext");
}
return ConditionOutcome.noMatch("not a web application");
}

@ -48,10 +48,10 @@ public class PropertySourcesPropertyValues implements PropertyValues {
private final PropertySources propertySources;
private final Collection<String> NON_ENUMERABLE_ENUMERABLES = Arrays.asList(
private static final Collection<String> NON_ENUMERABLE_ENUMERABLES = Arrays.asList(
StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME,
StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME);
/**
* Create a new PropertyValues from the given PropertySources
* @param propertySources a PropertySources instance
@ -107,7 +107,7 @@ public class PropertySourcesPropertyValues implements PropertyValues {
PropertySourcesPropertyResolver resolver, String[] includes, String[] exacts) {
if (source.getPropertyNames().length > 0) {
for (String propertyName : source.getPropertyNames()) {
if (this.NON_ENUMERABLE_ENUMERABLES.contains(source.getName())
if (PropertySourcesPropertyValues.NON_ENUMERABLE_ENUMERABLES.contains(source.getName())
&& !PatternMatchUtils.simpleMatch(includes, propertyName)) {
continue;
}

@ -50,7 +50,6 @@ import org.springframework.test.context.web.WebMergedContextConfiguration;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.context.support.GenericWebApplicationContext;
import org.springframework.web.context.support.StandardServletEnvironment;
/**
* A {@link ContextLoader} that can be used to test Spring Boot applications (those that
@ -82,9 +81,6 @@ public class SpringApplicationContextLoader extends AbstractContextLoader {
SpringApplication application = getSpringApplication();
application.setSources(getSources(config));
ConfigurableEnvironment environment = new StandardEnvironment();
if (config instanceof WebMergedContextConfiguration) {
environment = new StandardServletEnvironment();
}
if (!ObjectUtils.isEmpty(config.getActiveProfiles())) {
String profiles = StringUtils.arrayToCommaDelimitedString(config
.getActiveProfiles());

Loading…
Cancel
Save