I need help controlling the behavior of a couple of 3rd party libraries I am required to use in my application:
DBLib makes a lot of static-method calls to PropsLib to acquire configuration settings. For example: String dbHost = PropsLib.getString("dbHost")
. PropsLib uses non-standard .properties
files that is reads from the filesystem. (non-standard meaning they have a quirky placeholder syntax that doesn't match any of our other .properties
files) Also, the method for externalizing (overriding) those files per-environment is strange and clunky.
Are there any design strategies I could use that would allow me to use my existing Spring-based configuration mechanisms here? Or is my only option to write my own implementation of the PropsLib library?
答案 0 :(得分:1)
If PropsLib
is as short and easy as you described, I would recommend you to reimplement it in your own code to cheat DBLib
and retrieve your spring-based configuration, instead using the properties file you hate :)
Of course, if PropsLib
is in a .jar
you would need to remove it from that archive before. You could also include your own version inside the .jar
but this is not mandatory.