Skip to content

Commit

Permalink
GH-2988: Use @Config(proxyBeanMethods=false) (#2989)
Browse files Browse the repository at this point in the history
* GH-2988: Use `@Config(proxyBeanMethods=false)`

Fixes #2988

For faster startup (and possibility to compile to native code with GraalVM)
use a `proxyBeanMethods = false` on all the `@Configuration` classes
in the Framework
* Provide some other code style polishing

* * Fix Checkstyle violation
  • Loading branch information
artembilan authored and garyrussell committed Jul 22, 2019
1 parent 989d317 commit 084aaf7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
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]));
}

}

0 comments on commit 084aaf7

Please sign in to comment.