File tree Expand file tree Collapse file tree 4 files changed +8
-14
lines changed
main/java/org/springframework/core/env
test/java/org/springframework/core/env
spring-web/src/main/java/org/springframework/web/context/support Expand file tree Collapse file tree 4 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -129,8 +129,8 @@ public AbstractEnvironment() {
129
129
* {@link #customizePropertySources(MutablePropertySources)} during
130
130
* construction to allow subclasses to contribute or manipulate
131
131
* {@link PropertySource} instances as appropriate.
132
- * @see #customizePropertySources(MutablePropertySources)
133
132
* @since 5.3.4
133
+ * @see #customizePropertySources(MutablePropertySources)
134
134
*/
135
135
protected AbstractEnvironment (MutablePropertySources propertySources ) {
136
136
this .propertySources = propertySources ;
@@ -142,17 +142,17 @@ protected AbstractEnvironment(MutablePropertySources propertySources) {
142
142
/**
143
143
* Factory method used to create the {@link ConfigurablePropertyResolver}
144
144
* instance used by the Environment.
145
- * @see #getPropertyResolver()
146
145
* @since 5.3.4
146
+ * @see #getPropertyResolver()
147
147
*/
148
- protected ConfigurablePropertyResolver createPropertyResolver (
149
- MutablePropertySources propertySources ) {
148
+ protected ConfigurablePropertyResolver createPropertyResolver (MutablePropertySources propertySources ) {
150
149
return new PropertySourcesPropertyResolver (propertySources );
151
150
}
152
151
153
152
/**
154
153
* Return the {@link ConfigurablePropertyResolver} being used by the
155
154
* {@link Environment}.
155
+ * @since 5.3.4
156
156
* @see #createPropertyResolver(MutablePropertySources)
157
157
*/
158
158
protected final ConfigurablePropertyResolver getPropertyResolver () {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2019 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
Original file line number Diff line number Diff line change @@ -131,18 +131,15 @@ protected String doGetDefaultProfilesProperty() {
131
131
132
132
@ Test
133
133
public void withCustomMutablePropertySources () {
134
- class CustomMutablePropertySources extends MutablePropertySources {
135
- }
134
+ class CustomMutablePropertySources extends MutablePropertySources {}
136
135
MutablePropertySources propertySources = new CustomMutablePropertySources ();
137
- ConfigurableEnvironment env = new AbstractEnvironment (propertySources ) {
138
- };
136
+ ConfigurableEnvironment env = new AbstractEnvironment (propertySources ) {};
139
137
assertThat (env .getPropertySources ()).isInstanceOf (CustomMutablePropertySources .class );
140
138
}
141
139
142
140
@ Test
143
141
void withCustomPropertyResolver () {
144
142
class CustomPropertySourcesPropertyResolver extends PropertySourcesPropertyResolver {
145
-
146
143
public CustomPropertySourcesPropertyResolver (
147
144
PropertySources propertySources ) {
148
145
super (propertySources );
@@ -152,16 +149,13 @@ public CustomPropertySourcesPropertyResolver(
152
149
public String getProperty (String key ) {
153
150
return super .getProperty (key )+"-test" ;
154
151
}
155
-
156
152
}
157
153
ConfigurableEnvironment env = new AbstractEnvironment () {
158
-
159
154
@ Override
160
155
protected ConfigurablePropertyResolver createPropertyResolver (
161
156
MutablePropertySources propertySources ) {
162
157
return new CustomPropertySourcesPropertyResolver (propertySources );
163
158
}
164
-
165
159
};
166
160
Map <String , Object > values = new LinkedHashMap <>();
167
161
values .put ("spring" , "framework" );
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
You can’t perform that action at this time.
0 commit comments