Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
f4c68dbc
Commit
f4c68dbc
authored
Apr 02, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not set server.port=-1 for non embedded tests
Closes gh-16998
parent
1199b7c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
17 deletions
+0
-17
SpringBootContextLoader.java
...gframework/boot/test/context/SpringBootContextLoader.java
+0
-17
No files found.
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java
View file @
f4c68dbc
...
...
@@ -23,10 +23,6 @@ import java.util.List;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.WebApplicationType
;
import
org.springframework.boot.context.properties.bind.Bindable
;
import
org.springframework.boot.context.properties.bind.Binder
;
import
org.springframework.boot.context.properties.source.ConfigurationPropertySource
;
import
org.springframework.boot.context.properties.source.MapConfigurationPropertySource
;
import
org.springframework.boot.test.context.SpringBootTest.WebEnvironment
;
import
org.springframework.boot.test.mock.web.SpringBootMockServletContext
;
import
org.springframework.boot.test.util.TestPropertyValues
;
...
...
@@ -166,9 +162,6 @@ public class SpringBootContextLoader extends AbstractContextLoader {
// JMX bean names will clash if the same bean is used in multiple contexts
disableJmx
(
properties
);
properties
.
addAll
(
Arrays
.
asList
(
config
.
getPropertySourceProperties
()));
if
(!
isEmbeddedWebEnvironment
(
config
)
&&
!
hasCustomServerPort
(
properties
))
{
properties
.
add
(
"server.port=-1"
);
}
return
StringUtils
.
toStringArray
(
properties
);
}
...
...
@@ -176,16 +169,6 @@ public class SpringBootContextLoader extends AbstractContextLoader {
properties
.
add
(
"spring.jmx.enabled=false"
);
}
private
boolean
hasCustomServerPort
(
List
<
String
>
properties
)
{
Binder
binder
=
new
Binder
(
convertToConfigurationPropertySource
(
properties
));
return
binder
.
bind
(
"server.port"
,
Bindable
.
of
(
String
.
class
)).
isBound
();
}
private
ConfigurationPropertySource
convertToConfigurationPropertySource
(
List
<
String
>
properties
)
{
return
new
MapConfigurationPropertySource
(
TestPropertySourceUtils
.
convertInlinedPropertiesToMap
(
StringUtils
.
toStringArray
(
properties
)));
}
/**
* Return the {@link ApplicationContextInitializer initializers} that will be applied
* to the context. By default this method will adapt {@link ContextCustomizer context
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment