spring-cloud / spring-cloud/spring-cloud-commons

About ApplicationEvent and BootStrap

Open
#1,119 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
751
Forks
744
Avg merge
1d 14h
Merged PRs (30d)
9

Description

When I use "Spring Event Listener" to listen to the custom event "LivkEvent", use Spring.factories for autowiring, and introduce "org.springframework.cloud:spring-cloud-starter-bootstrap", my "Spring Event Listener" will Executed twice, I observed that the parent Application was generated when the event was published

image
event-demo.zip

this my demo code
I'm not sure if it's a bug or just by design
If the design is like this, what is a good solution

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached event-demo.zip and reproduce the custom ApplicationEvent with Spring.factories and org.springframework.cloud:spring-cloud-starter-bootstrap. Inspect how the parent and application contexts are created and how the listener is registered. Done means determining whether the duplicate execution is intentional and documenting or correcting the behavior accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.