nice solution for this.
I was writing a lib (standalone plain groovy/java project with minimal dependencies) for integration with 3-rd party functionality that can potentially have multiple providers. It is then published as a jar to a company maven repo. I'ts just a utility lib to be used by other applications (spring boot, grails)
client code
V
my lib pub classes with fixed interface
V
provider specific unstable classes
V
remote api
For example, if it's enterprise system that works with stock market data, then my lib is the one which performs getting stock information from multiple providers (yahoo, finbox, iex, etc). It has generic classes like "Stock", "StockProvider" to be used by client code. Client code can retrieve both some specific stock provider and default one.
The problem. It needs configuration (like stock.yahoo.url, stock.yahoo.pubKey, stock.finbox.url ...) and that configuration must be external. I.e. it's client application's (that uses my lib) responsibility to manage configuration for stock providers. Also it should be reconfigurable in runtime. How would you design that configuration mechanism? Maybe you already have some best practice for externalizing config of small libs?
can be used XML and *.properties config files? 🤔 I mean at the same level/folder where the API *.jar is placed on path/classpath.
Обсуждают сегодня