I have a Spring Boot application that is using JDBC auto-configuration to start up a pooled datasource to be used by a few camel components. Seems to work quite nice.
The issue is now that when I shutdown the app (press ctrl+c on the console) Spring Boot is shutting down the JDBC pool before the Camel Context. And since a few routes using the datasource may take a few seconds longer to complete but need to access the datasource I end up getting an Exception that the datasource was already closed and the route failes. Any clean solution on how to make sure that CamelContext is the first thing to get shut down and keep other beans alive until it was actually able to gracefully shutdown? Thanks