In my app, I have a service that connects to a database via Hibernate. I would like to have this service consume changes made to an external configuration file and implement those changes at runtime. An example of why this would be needed is if we needed to turn on hibernate.show_sql operationally to help diagnose an issue.
Hibernate's LocalSessionFactoryBean accepts a number of properties, one of which is an argument called "hibernateProperties" and is a Properties object. This object holds a number of properties, including "hibernate.show_sql". Unfortunately, because "hibernate.show_sql" is a property of a property (the Properties object), I cannot simply do an
When the external configuration file is changed, this will reset the properties in my service, but it will not restart the service, so the values are not used.
<osgix:managed-properties persistent-id="myApp.connector" update-strategy="container-managed"/>
Additionally, because the properties have characters that are not valid for Java methods or attributes (the "." character), I cannot simply create a pojo extending Properties to hold the properties, and inject that object into the "hibernateProperties" property.
So, my question is, how does one use "managed-properties" in this situation? It was suggested I use blueprint, but I'm not ready to abandon SpringDM yet. Any suggestions?