Optimize BPPs as AopInfrastructureBean

There is no need to post-process the framework internal BPPs.
Therefore, mark `GatewayProxyInstantiationPostProcessor`, `GlobalChannelInterceptorProcessor`, `IntegrationFlowBeanPostProcessor`
and `BaseIntegrationFlowDefinition.ReplyProducerCleaner` as an `AopInfrastructureBean`.
This way they are not post-processed via AOP `BeanPostProcessor`

* Migrate `org.springframework.integration.aop` tests to JUnit 5
* Fix race condition in the `FluxMessageChannelTests.noMemoryLeakInFluxMessageChannelForVolatilePublishers()`
where `FluxMessageChannel.upstreamSubscriptions` is updated from a different thread

(cherry picked from commit a8ed1dd9aa)
This commit is contained in:
Artem Bilan
2024-02-09 17:35:06 -05:00
committed by Spring Builds
parent de291d81d1
commit 9ae23dc0b8
13 changed files with 64 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022 the original author or authors.
* Copyright 2022-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.springframework.integration.config;
import org.springframework.aop.framework.AopInfrastructureBean;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition;
import org.springframework.beans.factory.aot.BeanRegistrationAotContribution;
@@ -44,7 +45,7 @@ import org.springframework.integration.gateway.AnnotationGatewayProxyFactoryBean
* @see AnnotationGatewayProxyFactoryBean
*/
class GatewayProxyInstantiationPostProcessor implements
InstantiationAwareBeanPostProcessor, BeanRegistrationAotProcessor, ApplicationContextAware {
InstantiationAwareBeanPostProcessor, BeanRegistrationAotProcessor, ApplicationContextAware, AopInfrastructureBean {
private final BeanDefinitionRegistry registry;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aop.framework.AopInfrastructureBean;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
@@ -54,7 +55,7 @@ import org.springframework.util.StringUtils;
* @since 2.0
*/
public final class GlobalChannelInterceptorProcessor
implements BeanFactoryAware, SmartInitializingSingleton, BeanPostProcessor {
implements BeanFactoryAware, SmartInitializingSingleton, BeanPostProcessor, AopInfrastructureBean {
private static final Log LOGGER = LogFactory.getLog(GlobalChannelInterceptorProcessor.class);

View File

@@ -29,6 +29,7 @@ import reactor.core.publisher.Flux;
import reactor.util.function.Tuple2;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.AopInfrastructureBean;
import org.springframework.aop.support.AopUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanCreationException;
@@ -3047,7 +3048,7 @@ public abstract class BaseIntegrationFlowDefinition<B extends BaseIntegrationFlo
}
}
public static final class ReplyProducerCleaner implements DestructionAwareBeanPostProcessor {
public static final class ReplyProducerCleaner implements DestructionAwareBeanPostProcessor, AopInfrastructureBean {
@Override
public boolean requiresDestruction(Object bean) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 the original author or authors.
* Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.integration.dsl.context;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.aop.framework.AopInfrastructureBean;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.aop.support.NameMatchMethodPointcutAdvisor;
import org.springframework.beans.BeansException;
@@ -90,7 +91,7 @@ import org.springframework.util.StringValueResolver;
* @since 5.0
*/
public class IntegrationFlowBeanPostProcessor
implements BeanPostProcessor, ApplicationContextAware, SmartInitializingSingleton {
implements BeanPostProcessor, ApplicationContextAware, SmartInitializingSingleton, AopInfrastructureBean {
private ConfigurableApplicationContext applicationContext;