|
23 | 23 | import org.springframework.beans.BeanUtils;
|
24 | 24 | import org.springframework.boot.SpringApplication;
|
25 | 25 | import org.springframework.boot.WebApplicationType;
|
26 |
| -import org.springframework.boot.context.properties.bind.Bindable; |
27 |
| -import org.springframework.boot.context.properties.bind.Binder; |
28 |
| -import org.springframework.boot.context.properties.source.ConfigurationPropertySource; |
29 |
| -import org.springframework.boot.context.properties.source.MapConfigurationPropertySource; |
30 | 26 | import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
31 | 27 | import org.springframework.boot.test.mock.web.SpringBootMockServletContext;
|
32 | 28 | import org.springframework.boot.test.util.TestPropertyValues;
|
@@ -166,26 +162,13 @@ protected String[] getInlinedProperties(MergedContextConfiguration config) {
|
166 | 162 | // JMX bean names will clash if the same bean is used in multiple contexts
|
167 | 163 | disableJmx(properties);
|
168 | 164 | properties.addAll(Arrays.asList(config.getPropertySourceProperties()));
|
169 |
| - if (!isEmbeddedWebEnvironment(config) && !hasCustomServerPort(properties)) { |
170 |
| - properties.add("server.port=-1"); |
171 |
| - } |
172 | 165 | return StringUtils.toStringArray(properties);
|
173 | 166 | }
|
174 | 167 |
|
175 | 168 | private void disableJmx(List<String> properties) {
|
176 | 169 | properties.add("spring.jmx.enabled=false");
|
177 | 170 | }
|
178 | 171 |
|
179 |
| - private boolean hasCustomServerPort(List<String> properties) { |
180 |
| - Binder binder = new Binder(convertToConfigurationPropertySource(properties)); |
181 |
| - return binder.bind("server.port", Bindable.of(String.class)).isBound(); |
182 |
| - } |
183 |
| - |
184 |
| - private ConfigurationPropertySource convertToConfigurationPropertySource(List<String> properties) { |
185 |
| - return new MapConfigurationPropertySource( |
186 |
| - TestPropertySourceUtils.convertInlinedPropertiesToMap(StringUtils.toStringArray(properties))); |
187 |
| - } |
188 |
| - |
189 | 172 | /**
|
190 | 173 | * Return the {@link ApplicationContextInitializer initializers} that will be applied
|
191 | 174 | * to the context. By default this method will adapt {@link ContextCustomizer context
|
|
0 commit comments