Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publishing of PayloadApplicationEvents in parent context #30420

Conversation

simonbasle
Copy link
Contributor

@simonbasle simonbasle commented May 4, 2023

This commit introduces a more defensive propagation of an event
and the optionally associated eventType when calling publishEvent,
especially when a parent context is present.

Notably, it avoids a situation where the parent publishEvent call
would generate a new PayloadApplicationEvent with the wrong eventType
(PayloadApplicationEvent<PayloadApplicationEvent<T>>).

This commit also adds test coverage (which includes cases where an event
is fired before the multicaster is set) and a defensive check against
inconsistent publishing of a PayloadApplicationEvent (even though that
is something that is expected to be done mostly internally by the
framework).

See gh-30360
Closes gh-30420

This commit introduces a more defensive propagation of an event
and the optionally associated eventType when calling `publishEvent`,
especially when a parent context is present.

Notably, it avoids a situation where the parent `publishEvent` call
would generate a new `PayloadApplicationEvent` with the wrong eventType
(`PayloadApplicationEvent<PayloadApplicationEvent<T>>`).

This commit also adds test coverage (which includes cases where an event
is fired before the multicaster is set) and a defensive check against
inconsistent publishing of a PayloadApplicationEvent (even though that
is something that is expected to be done mostly internally by the
framework).

Closes spring-projectsgh-30360
@simonbasle simonbasle added this to the 6.0.9 milestone May 4, 2023
@simonbasle simonbasle added type: regression A bug that is also a regression in: core Issues in core modules (aop, beans, core, context, expression) labels May 4, 2023
@simonbasle simonbasle self-assigned this May 4, 2023
@simonbasle simonbasle requested a review from a team May 4, 2023 11:21
@jhoeller jhoeller removed this from the 6.0.9 milestone May 10, 2023
@simonbasle simonbasle added the status: declined A suggestion or change that we don't feel we should currently apply label May 10, 2023
@simonbasle
Copy link
Contributor Author

superseded by e228f4b

@simonbasle simonbasle closed this May 10, 2023
@simonbasle simonbasle deleted the 30360-parentApplicationEventListener branch May 10, 2023 15:34
@simonbasle simonbasle added status: superseded An issue that has been superseded by another and removed status: declined A suggestion or change that we don't feel we should currently apply labels May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: superseded An issue that has been superseded by another type: regression A bug that is also a regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants