I use com.google.inject.persist.jpa.JpaPersistModule
in my application. The configuration is located in persistence.xml
file, but some of the properties are dynamic and I don't want store them in this file (for example javax.persistence.jdbc.url
etc) but rather inject them from some other source.
I know that there's a JpaPersistModule.properties(java.util.Properties p)
method that allows to do exactly what I need. The problem is that I don't see a good way to pass that java.util.Properties
object to the module. I don't want to explicitely create an instance of java.util.Properties
in the module code, but would rather use some guice-style mechanism to inject it.
Is that possible at all? How would you decouple JPA module and its configuration properties?