CAMEL-10552: spring-boot: make component lazy loading
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/63e4b801 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/63e4b801 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/63e4b801 Branch: refs/heads/camel-2.18.x Commit: 63e4b801919624d74ba2c289189179294fb27a1c Parents: 9ce3d18 Author: lburgazzoli <[email protected]> Authored: Tue Dec 6 16:29:06 2016 +0100 Committer: lburgazzoli <[email protected]> Committed: Tue Dec 6 16:29:06 2016 +0100 ---------------------------------------------------------------------- .../camel/maven/packaging/SpringBootAutoConfigurationMojo.java | 2 ++ 1 file changed, 2 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/63e4b801/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java index d7344c1..8ebe2f4 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java @@ -82,6 +82,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Scope; import org.springframework.core.type.AnnotatedTypeMetadata; @@ -811,6 +812,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo { // Determine all the aliases String[] springBeanAliases = componentAliases.stream().map(alias -> alias + "-component").toArray(size -> new String[size]); + method.addAnnotation(Lazy.class); method.addAnnotation(Bean.class).setStringArrayValue("name", springBeanAliases); method.addAnnotation(ConditionalOnClass.class).setLiteralValue("value", "CamelContext.class"); method.addAnnotation(ConditionalOnMissingBean.class).setLiteralValue("value", model.getShortJavaType() + ".class");
