Browse Source

Merge branch '2.0.x'

pull/14975/head
Phillip Webb 7 years ago
parent
commit
c393f6262e
  1. 2
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/liquibase/LiquibaseEndpointAutoConfigurationTests.java
  2. 2
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java
  3. 2
      spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java
  4. 2
      spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java
  5. 1
      spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java
  6. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/PlaceholdersResolver.java
  7. 11
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySource.java
  8. 11
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameAliases.java
  9. 2
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/codec/CodecCustomizer.java
  10. 12
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java

2
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/liquibase/LiquibaseEndpointAutoConfigurationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

2
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

2
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/DefaultRestartInitializer.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

2
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/DefaultRestartInitializerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

1
spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java

@ -174,7 +174,6 @@ class PropertiesMigrationReporter { @@ -174,7 +174,6 @@ class PropertiesMigrationReporter {
private Map<String, ConfigurationPropertySource> getPropertySourcesAsMap() {
Map<String, ConfigurationPropertySource> map = new LinkedHashMap<>();
ConfigurationPropertySources.get(this.environment);
for (ConfigurationPropertySource source : ConfigurationPropertySources
.get(this.environment)) {
map.put(determinePropertySourceName(source), source);

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/PlaceholdersResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

11
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySource.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -65,6 +65,15 @@ class AliasedConfigurationPropertySource implements ConfigurationPropertySource @@ -65,6 +65,15 @@ class AliasedConfigurationPropertySource implements ConfigurationPropertySource
return aliasResult;
}
}
for (ConfigurationPropertyName from : getAliases()) {
for (ConfigurationPropertyName alias : getAliases().getAliases(from)) {
if (name.isAncestorOf(alias)) {
if (this.source.getConfigurationProperty(from) != null) {
return ConfigurationPropertyState.PRESENT;
}
}
}
}
return ConfigurationPropertyState.ABSENT;
}

11
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameAliases.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package org.springframework.boot.context.properties.source; @@ -18,6 +18,7 @@ package org.springframework.boot.context.properties.source;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -33,7 +34,8 @@ import org.springframework.util.MultiValueMap; @@ -33,7 +34,8 @@ import org.springframework.util.MultiValueMap;
* @since 2.0.0
* @see ConfigurationPropertySource#withAliases(ConfigurationPropertyNameAliases)
*/
public final class ConfigurationPropertyNameAliases {
public final class ConfigurationPropertyNameAliases
implements Iterable<ConfigurationPropertyName> {
private final MultiValueMap<ConfigurationPropertyName, ConfigurationPropertyName> aliases = new LinkedMultiValueMap<>();
@ -74,4 +76,9 @@ public final class ConfigurationPropertyNameAliases { @@ -74,4 +76,9 @@ public final class ConfigurationPropertyNameAliases {
.findFirst().orElse(null);
}
@Override
public Iterator<ConfigurationPropertyName> iterator() {
return this.aliases.keySet().iterator();
}
}

2
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/codec/CodecCustomizer.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

12
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.boot.context.properties.source;
import java.util.Collections;
import org.junit.Test;
import org.mockito.Answers;
@ -111,6 +113,16 @@ public class AliasedConfigurationPropertySourceTests { @@ -111,6 +113,16 @@ public class AliasedConfigurationPropertySourceTests {
.isEqualTo(ConfigurationPropertyState.PRESENT);
}
@Test
public void containsDescendantOfWhenPresentInAliasShouldReturnPresent() {
ConfigurationPropertySource source = new MapConfigurationPropertySource(
Collections.singletonMap("foo.bar", "foobar"));
ConfigurationPropertySource aliased = source
.withAliases(new ConfigurationPropertyNameAliases("foo.bar", "baz.foo"));
assertThat(aliased.containsDescendantOf(ConfigurationPropertyName.of("baz")))
.isEqualTo(ConfigurationPropertyState.PRESENT);
}
private Object getValue(ConfigurationPropertySource source, String name) {
ConfigurationProperty property = source
.getConfigurationProperty(ConfigurationPropertyName.of(name));

Loading…
Cancel
Save