Skip to content

Commit 582559d

Browse files
committed
Polish "Allow customer resolver and property sources"
See gh-26462
1 parent d4c609f commit 582559d

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

spring-core/src/main/java/org/springframework/core/env/AbstractEnvironment.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ public AbstractEnvironment() {
129129
* {@link #customizePropertySources(MutablePropertySources)} during
130130
* construction to allow subclasses to contribute or manipulate
131131
* {@link PropertySource} instances as appropriate.
132-
* @see #customizePropertySources(MutablePropertySources)
133132
* @since 5.3.4
133+
* @see #customizePropertySources(MutablePropertySources)
134134
*/
135135
protected AbstractEnvironment(MutablePropertySources propertySources) {
136136
this.propertySources = propertySources;
@@ -142,17 +142,17 @@ protected AbstractEnvironment(MutablePropertySources propertySources) {
142142
/**
143143
* Factory method used to create the {@link ConfigurablePropertyResolver}
144144
* instance used by the Environment.
145-
* @see #getPropertyResolver()
146145
* @since 5.3.4
146+
* @see #getPropertyResolver()
147147
*/
148-
protected ConfigurablePropertyResolver createPropertyResolver(
149-
MutablePropertySources propertySources) {
148+
protected ConfigurablePropertyResolver createPropertyResolver(MutablePropertySources propertySources) {
150149
return new PropertySourcesPropertyResolver(propertySources);
151150
}
152151

153152
/**
154153
* Return the {@link ConfigurablePropertyResolver} being used by the
155154
* {@link Environment}.
155+
* @since 5.3.4
156156
* @see #createPropertyResolver(MutablePropertySources)
157157
*/
158158
protected final ConfigurablePropertyResolver getPropertyResolver() {

spring-core/src/main/java/org/springframework/core/env/StandardEnvironment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

spring-core/src/test/java/org/springframework/core/env/CustomEnvironmentTests.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,15 @@ protected String doGetDefaultProfilesProperty() {
131131

132132
@Test
133133
public void withCustomMutablePropertySources() {
134-
class CustomMutablePropertySources extends MutablePropertySources {
135-
}
134+
class CustomMutablePropertySources extends MutablePropertySources {}
136135
MutablePropertySources propertySources = new CustomMutablePropertySources();
137-
ConfigurableEnvironment env = new AbstractEnvironment(propertySources) {
138-
};
136+
ConfigurableEnvironment env = new AbstractEnvironment(propertySources) {};
139137
assertThat(env.getPropertySources()).isInstanceOf(CustomMutablePropertySources.class);
140138
}
141139

142140
@Test
143141
void withCustomPropertyResolver() {
144142
class CustomPropertySourcesPropertyResolver extends PropertySourcesPropertyResolver {
145-
146143
public CustomPropertySourcesPropertyResolver(
147144
PropertySources propertySources) {
148145
super(propertySources);
@@ -152,16 +149,13 @@ public CustomPropertySourcesPropertyResolver(
152149
public String getProperty(String key) {
153150
return super.getProperty(key)+"-test";
154151
}
155-
156152
}
157153
ConfigurableEnvironment env = new AbstractEnvironment() {
158-
159154
@Override
160155
protected ConfigurablePropertyResolver createPropertyResolver(
161156
MutablePropertySources propertySources) {
162157
return new CustomPropertySourcesPropertyResolver(propertySources);
163158
}
164-
165159
};
166160
Map<String, Object> values = new LinkedHashMap<>();
167161
values.put("spring", "framework");

spring-web/src/main/java/org/springframework/web/context/support/StandardServletEnvironment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)