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
9e6e200d
Commit
9e6e200d
authored
Oct 20, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Describe how to handle application events from descendant contexts
Closes gh-8899
parent
c88559e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+11
-0
No files found.
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
9e6e200d
...
...
@@ -242,6 +242,17 @@ Application events are sent in the following order, as your application runs:
TIP: You often won't need to use application events, but it can be handy to know that they
exist. Internally, Spring Boot uses events to handle a variety of tasks.
Application events are sent using Spring Framework's event publishing mechanism. Part of
this mechanism ensures that an event published to the listeners in a child context
is also published to the listeners in any ancestors contexts. As a result of this, if
your application uses a hierarchy of `SpringApplication` instances, a listener may
receive multiple instances of the same type of application event.
To allow your listener to distinguish between an event for its context and an event for
a descendant context, it should request that its application context is injected and
then compare the injected context with context of the event. The context can be injected
by implementing `ApplicationContextAware` or, if the listener is a bean, using `@Autowired`.
[[boot-features-web-environment]]
...
...
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