Merge branch '7.0.x'

This commit is contained in:
Brian Clozel
2026-08-31 18:39:19 +02:00
7 changed files with 79 additions and 22 deletions
@@ -106,8 +106,8 @@ public abstract class AbstractApplicationEventMulticaster
synchronized (this.defaultRetriever) {
// Explicitly remove target for a proxy, if registered already,
// in order to avoid double invocations of the same listener.
Object singletonTarget = AopProxyUtils.getSingletonTarget(listener);
if (singletonTarget instanceof ApplicationListener) {
Object singletonTarget = AopProxyUtils.ultimateSingletonTarget(listener);
if (singletonTarget != listener && singletonTarget instanceof ApplicationListener) {
this.defaultRetriever.applicationListeners.remove(singletonTarget);
}
this.defaultRetriever.applicationListeners.add(listener);
@@ -270,7 +270,7 @@ public abstract class AbstractApplicationEventMulticaster
// and replace them by their proxy counterparts, because if both a proxy and its target end up
// in 'allListeners', listeners will fire twice.
ApplicationListener<?> unwrappedListener =
(ApplicationListener<?>) AopProxyUtils.getSingletonTarget(listener);
(ApplicationListener<?>) AopProxyUtils.ultimateSingletonTarget(listener);
if (listener != unwrappedListener) {
if (filteredListeners != null && filteredListeners.contains(unwrappedListener)) {
filteredListeners.remove(unwrappedListener);
@@ -326,10 +326,7 @@ public class ScheduledAnnotationBeanPostProcessor
* @param bean the target bean instance
*/
protected void processScheduled(Scheduled scheduled, Method method, Object bean) {
Object key = AopProxyUtils.getSingletonTarget(bean);
if (key == null) {
key = bean;
}
Object key = AopProxyUtils.ultimateSingletonTarget(bean);
// Is the method a Kotlin suspending function? Throws if true and the reactor bridge isn't on the classpath.
// Does the method return a reactive type? Throws if true and it isn't a deferred Publisher type.
@@ -108,12 +108,8 @@ public class BeanValidationPostProcessor implements BeanPostProcessor, Initializ
*/
protected void doValidate(Object bean) {
Assert.state(this.validator != null, "No Validator set");
Object objectToValidate = AopProxyUtils.getSingletonTarget(bean);
if (objectToValidate == null) {
objectToValidate = bean;
}
Object objectToValidate = AopProxyUtils.ultimateSingletonTarget(bean);
Set<ConstraintViolation<Object>> result = this.validator.validate(objectToValidate);
if (!result.isEmpty()) {
StringBuilder sb = new StringBuilder("Bean state is invalid: ");
for (Iterator<ConstraintViolation<Object>> it = result.iterator(); it.hasNext();) {