Skip to content

GH-2988: Use @Config(proxyBeanMethods=false) #2989

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

Merged
merged 2 commits into from
Jul 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*
* @since 4.2
*/
@Configuration
@Configuration(proxyBeanMethods = false)
public class IntegrationManagementConfiguration implements ImportAware, EnvironmentAware {

private AnnotationAttributes attributes;
Expand All @@ -60,7 +60,7 @@ public void setEnvironment(Environment environment) {
public void setImportMetadata(AnnotationMetadata importMetadata) {
Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableIntegrationManagement.class.getName());
this.attributes = AnnotationAttributes.fromMap(map);
Assert.notNull(this.attributes,
Assert.notNull(this.attributes, () ->
"@EnableIntegrationManagement is not present on importing class " + importMetadata.getClassName());
}

Expand All @@ -85,7 +85,7 @@ public IntegrationManagementConfigurer managementConfigurer() {
}

private void setupCountsEnabledNamePatterns(IntegrationManagementConfigurer configurer) {
List<String> patterns = new ArrayList<String>();
List<String> patterns = new ArrayList<>();
String[] countsEnabled = this.attributes.getStringArray("countsEnabled");
for (String managedComponent : countsEnabled) {
String pattern = this.environment.resolvePlaceholders(managedComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@
*
* @since 4.0
*/
@Configuration
@Configuration(proxyBeanMethods = false)
public class IntegrationMBeanExportConfiguration implements ImportAware, EnvironmentAware, BeanFactoryAware {

private static final String MBEAN_EXPORTER_NAME = "integrationMbeanExporter";
/**
* A name for default {@link IntegrationMBeanExporter} bean.
*/
public static final String MBEAN_EXPORTER_NAME = "integrationMbeanExporter";

private AnnotationAttributes attributes;

Expand Down Expand Up @@ -95,7 +98,7 @@ public void setEnvironment(Environment environment) {
public void setImportMetadata(AnnotationMetadata importMetadata) {
Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableIntegrationMBeanExport.class.getName());
this.attributes = AnnotationAttributes.fromMap(map);
Assert.notNull(this.attributes,
Assert.notNull(this.attributes, () ->
"@EnableIntegrationMBeanExport is not present on importing class " + importMetadata.getClassName());
}

Expand All @@ -121,7 +124,7 @@ public IntegrationMBeanExporter mbeanExporter() {

private void setupDomain(IntegrationMBeanExporter exporter) {
String defaultDomain = this.attributes.getString("defaultDomain");
if (defaultDomain != null && this.environment != null) {
if (this.environment != null) {
defaultDomain = this.environment.resolvePlaceholders(defaultDomain);
}
if (StringUtils.hasText(defaultDomain)) {
Expand All @@ -131,11 +134,11 @@ private void setupDomain(IntegrationMBeanExporter exporter) {

private void setupServer(IntegrationMBeanExporter exporter) {
String server = this.attributes.getString("server");
if (server != null && this.environment != null) {
if (this.environment != null) {
server = this.environment.resolvePlaceholders(server);
}
if (StringUtils.hasText(server)) {
MBeanServer bean = null;
MBeanServer bean;
if (server.startsWith("#{") && server.endsWith("}")) {
bean = (MBeanServer) this.resolver.evaluate(server, this.expressionContext);
}
Expand All @@ -159,7 +162,7 @@ private void setupComponentNamePatterns(IntegrationMBeanExporter exporter) {
String pattern = this.environment.resolvePlaceholders(managedComponent);
patterns.addAll(Arrays.asList(StringUtils.commaDelimitedListToStringArray(pattern)));
}
exporter.setComponentNamePatterns(patterns.toArray(new String[patterns.size()]));
exporter.setComponentNamePatterns(patterns.toArray(new String[0]));
}

}