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
4451df21
Commit
4451df21
authored
Nov 06, 2015
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.2.x'
parents
e06198e9
f08f8727
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
49 deletions
+2
-49
EmbeddedWebApplicationContext.java
.../boot/context/embedded/EmbeddedWebApplicationContext.java
+2
-2
EmbeddedWebApplicationContextTests.java
.../context/embedded/EmbeddedWebApplicationContextTests.java
+0
-40
MockEmbeddedServletContainerFactory.java
...context/embedded/MockEmbeddedServletContainerFactory.java
+0
-7
No files found.
spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java
View file @
4451df21
...
@@ -146,9 +146,9 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
...
@@ -146,9 +146,9 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
}
}
@Override
@Override
protected
void
doClose
()
{
protected
void
onClose
()
{
super
.
onClose
();
stopAndReleaseEmbeddedServletContainer
();
stopAndReleaseEmbeddedServletContainer
();
super
.
doClose
();
}
}
private
synchronized
void
createEmbeddedServletContainer
()
{
private
synchronized
void
createEmbeddedServletContainer
()
{
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContextTests.java
View file @
4451df21
...
@@ -43,14 +43,11 @@ import org.mockito.MockitoAnnotations;
...
@@ -43,14 +43,11 @@ import org.mockito.MockitoAnnotations;
import
org.springframework.beans.MutablePropertyValues
;
import
org.springframework.beans.MutablePropertyValues
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.DisposableBean
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.beans.factory.config.ConstructorArgumentValues
;
import
org.springframework.beans.factory.config.ConstructorArgumentValues
;
import
org.springframework.beans.factory.config.Scope
;
import
org.springframework.beans.factory.config.Scope
;
import
org.springframework.beans.factory.support.BeanDefinitionBuilder
;
import
org.springframework.beans.factory.support.RootBeanDefinition
;
import
org.springframework.beans.factory.support.RootBeanDefinition
;
import
org.springframework.boot.context.embedded.MockEmbeddedServletContainerFactory.MockEmbeddedServletContainer
;
import
org.springframework.boot.context.web.ServerPortInfoApplicationContextInitializer
;
import
org.springframework.boot.context.web.ServerPortInfoApplicationContextInitializer
;
import
org.springframework.context.ApplicationContextException
;
import
org.springframework.context.ApplicationContextException
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.ApplicationListener
;
...
@@ -68,7 +65,6 @@ import org.springframework.web.filter.GenericFilterBean;
...
@@ -68,7 +65,6 @@ import org.springframework.web.filter.GenericFilterBean;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
equalTo
;
import
static
org
.
hamcrest
.
Matchers
.
instanceOf
;
import
static
org
.
hamcrest
.
Matchers
.
instanceOf
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
hamcrest
.
Matchers
.
nullValue
;
import
static
org
.
hamcrest
.
Matchers
.
nullValue
;
import
static
org
.
hamcrest
.
Matchers
.
sameInstance
;
import
static
org
.
hamcrest
.
Matchers
.
sameInstance
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
...
@@ -485,21 +481,6 @@ public class EmbeddedWebApplicationContextTests {
...
@@ -485,21 +481,6 @@ public class EmbeddedWebApplicationContextTests {
sameInstance
(
scope
));
sameInstance
(
scope
));
}
}
@Test
public
void
containerIsStoppedBeforeContextIsClosed
()
{
addEmbeddedServletContainerFactoryBean
();
this
.
context
.
registerBeanDefinition
(
"shutdownOrderingValidator"
,
BeanDefinitionBuilder
.
rootBeanDefinition
(
ShutdownOrderingValidator
.
class
)
.
addConstructorArgReference
(
"embeddedServletContainerFactory"
)
.
getBeanDefinition
());
this
.
context
.
refresh
();
ShutdownOrderingValidator
validator
=
this
.
context
.
getBean
(
ShutdownOrderingValidator
.
class
);
this
.
context
.
close
();
assertThat
(
validator
.
destroyed
,
is
(
true
));
assertThat
(
validator
.
containerStoppedFirst
,
is
(
true
));
}
private
void
addEmbeddedServletContainerFactoryBean
()
{
private
void
addEmbeddedServletContainerFactoryBean
()
{
this
.
context
.
registerBeanDefinition
(
"embeddedServletContainerFactory"
,
this
.
context
.
registerBeanDefinition
(
"embeddedServletContainerFactory"
,
new
RootBeanDefinition
(
MockEmbeddedServletContainerFactory
.
class
));
new
RootBeanDefinition
(
MockEmbeddedServletContainerFactory
.
class
));
...
@@ -552,25 +533,4 @@ public class EmbeddedWebApplicationContextTests {
...
@@ -552,25 +533,4 @@ public class EmbeddedWebApplicationContextTests {
}
}
protected
static
class
ShutdownOrderingValidator
implements
DisposableBean
{
private
final
MockEmbeddedServletContainer
servletContainer
;
private
boolean
destroyed
=
false
;
private
boolean
containerStoppedFirst
=
false
;
ShutdownOrderingValidator
(
MockEmbeddedServletContainerFactory
servletContainerFactory
)
{
this
.
servletContainer
=
servletContainerFactory
.
getContainer
();
}
@Override
public
void
destroy
()
{
this
.
destroyed
=
true
;
this
.
containerStoppedFirst
=
this
.
servletContainer
.
isStopped
();
}
}
}
}
spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java
View file @
4451df21
...
@@ -90,8 +90,6 @@ public class MockEmbeddedServletContainerFactory
...
@@ -90,8 +90,6 @@ public class MockEmbeddedServletContainerFactory
private
final
int
port
;
private
final
int
port
;
private
boolean
stopped
=
false
;
public
MockEmbeddedServletContainer
(
ServletContextInitializer
[]
initializers
,
public
MockEmbeddedServletContainer
(
ServletContextInitializer
[]
initializers
,
int
port
)
{
int
port
)
{
this
.
initializers
=
initializers
;
this
.
initializers
=
initializers
;
...
@@ -176,11 +174,6 @@ public class MockEmbeddedServletContainerFactory
...
@@ -176,11 +174,6 @@ public class MockEmbeddedServletContainerFactory
public
void
stop
()
{
public
void
stop
()
{
this
.
servletContext
=
null
;
this
.
servletContext
=
null
;
this
.
registeredServlets
.
clear
();
this
.
registeredServlets
.
clear
();
this
.
stopped
=
true
;
}
public
boolean
isStopped
()
{
return
this
.
stopped
;
}
}
public
Servlet
[]
getServlets
()
{
public
Servlet
[]
getServlets
()
{
...
...
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