How can I cleanly shut down resources used in an ApplicationContextInitializer
implementation?
I've created an ApplicationContextInitializer
implementation that uses the Curator project to connect to Zookeeper and acquire a properties file. It then creates a Properties
instance , a PropertiesPropertySource
and adds that to the context.
When the application shuts down, I'd like to be able to call close()
on the CuratorFramework
instance that was a member of my initializer. How is this best done?
Could I also pass the CuratorFramework
instance into the context, so I can use it as a bean?