Thanks for reply I already tried depends-on, it didn't work. Spring is closing camelContext before the destruction of any other bean..but after destroying camelTemplate.
I probably need a need a way to tell spring that camelTemplate depends on camelContet. And yes i am explicitly defining camelTemplate in xml. Here is how <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" trace="true" autoStartup="true" shutdownRoute="Defer" shutdownRunningTask="CompleteAllTasks" errorHandlerRef="dlc" > <jmxAgent id="agent" disabled="true"/> <errorHandler id="dlc" type="DeadLetterChannel" deadLetterUri="file:deadLetter"> </errorHandler> <template id="camelTemplate" camelContextId="camel"/> <route id="person-event" shutdownRoute="Defer"> ......................... </route> <route ......... </route> Looks like it is not a problem with spring batch. I plugged-in the exact configuration in our web app and got the same exception on server shutdown when some exchanges are inflisht. -- View this message in context: http://camel.465427.n5.nabble.com/Spring-destroys-camelTemplate-before-CamelContext-tp5464452p5466783.html Sent from the Camel - Users mailing list archive at Nabble.com.