Mitigate some IntegrationMBeanExporter early BF access

* Fix typo in the `spring-integration.xsd`
This commit is contained in:
Artem Bilan
2024-08-13 14:15:42 -04:00
parent 4d787554b8
commit 9180240ae0
7 changed files with 23 additions and 24 deletions

View File

@@ -9,7 +9,7 @@
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd">
<bean id="mbs" class="org.springframework.jmx.support.MBeanServerFactoryBean"/>
<bean id="mbs" class="org.springframework.jmx.support.MBeanServerFactoryBean" />
<si:channel id="testChannel"/>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 the original author or authors.
* Copyright 2018-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.
@@ -24,8 +24,10 @@ import javax.management.ObjectName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Role;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.context.IntegrationFlowContext;
@@ -98,6 +100,7 @@ public class DslMBeanTests {
public static class Config {
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public static MBeanServerFactoryBean mbeanServer() {
return new MBeanServerFactoryBean();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 the original author or authors.
* Copyright 2014-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.
@@ -27,9 +27,11 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Role;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.integration.channel.QueueChannel;
import org.springframework.integration.config.EnableIntegration;
@@ -107,10 +109,12 @@ public class EnableMBeanExportTests {
defaultDomain = "${managed.domain}",
managedComponents = {"input", "${managed.component}"})
@EnableIntegrationManagement(defaultLoggingEnabled = "false")
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public static class ContextConfiguration {
@Bean
public MBeanServerFactoryBean mbeanServer() {
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public static MBeanServerFactoryBean mbeanServer() {
return new MBeanServerFactoryBean();
}