When my Grails app starts up, I also begin a Spring Integration and Batch process in the background. I want to have some DB connection properties stored in the Config.groovy file, but how do I access them from a Java class used in teh Integration/Batch process?
I found this thread:
Converting Java -> Grails ... How do I load these properties?
Which suggests using:
private Map config = ConfigurationHolder.getFlatConfig();
followed by something like:
String driver = (String) config.get("jdbc.driver");
This actually works fine (teh properties are loaded correctly from Config.groovy) but the problem is that ConfigurationHolder is after being deprecated. And any thread I've found dealing with the issue seems to be Grails-specific and suggest using dependancy injection, like in this thread:
How to access Grails configuration in Grails 2.0?
So is there a non-deprecated way to get access to the Config.groovy properties from a Java class file?