CAMEL-7156: Backported this but keep the behavior as-is. End users can set shutdownEager=true to leverage this.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/086066e5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/086066e5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/086066e5 Branch: refs/heads/camel-2.12.x Commit: 086066e55c7c465f3f7628f4a42ccef00a830800 Parents: 826eb35 Author: Claus Ibsen <davscl...@apache.org> Authored: Fri Feb 28 15:59:43 2014 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Feb 28 15:59:43 2014 +0100 ---------------------------------------------------------------------- .../java/org/apache/camel/spring/SpringCamelContext.java | 8 ++++---- .../spring/SpringCamelContextShutdownBeforeBeanTest.xml | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/086066e5/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java index ce422ea..25bb21c 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java @@ -61,7 +61,7 @@ public class SpringCamelContext extends DefaultCamelContext implements Initializ private static final ThreadLocal<Boolean> NO_START = new ThreadLocal<Boolean>(); private ApplicationContext applicationContext; private EventComponent eventComponent; - private boolean shutdownEager = true; + private boolean shutdownEager; public SpringCamelContext() { } @@ -188,9 +188,9 @@ public class SpringCamelContext extends DefaultCamelContext implements Initializ * Whether to shutdown this {@link org.apache.camel.spring.SpringCamelContext} eager (first) * when Spring {@link org.springframework.context.ApplicationContext} is being stopped. * <p/> - * <b>Important:</b> This option is default <tt>true</tt> which ensures we shutdown Camel - * before other beans. Setting this to <tt>false</tt> restores old behavior in earlier - * Camel releases, which can be used for special cases to behave as before. + * <b>Important:</b> This option is default <tt>false</tt> to be backwards compatible + * with current behavior. Setting this to <tt>true</tt> ensures we shutdown + * Camel before any beans, which is also the default behavior in Camel 2.13 onwards. * * @return <tt>true</tt> to shutdown eager (first), <tt>false</tt> to shutdown last */ http://git-wip-us.apache.org/repos/asf/camel/blob/086066e5/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringCamelContextShutdownBeforeBeanTest.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringCamelContextShutdownBeforeBeanTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringCamelContextShutdownBeforeBeanTest.xml index f506a8e..ad02c49 100644 --- a/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringCamelContextShutdownBeforeBeanTest.xml +++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/SpringCamelContextShutdownBeforeBeanTest.xml @@ -31,7 +31,8 @@ <property name="shutdownOrderBean" ref="order"/> </bean> - <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring"> + <!-- shutdown eager is true, to shutdown Camel eager (first) --> + <camelContext id="myCamel" shutdownEager="true" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="seda:start"/> <to uri="bean:a?cache=false"/>