I have a microservice with a DB2 and PostgreSQL connection. I am using MyBatis for my db abstraction layer (vs say hibernate, jdbi, etc).
What is the jooby way of setting these up in context of modules or services?
val db2 = require("db1", DataSource::class.java)
val pgsql = require("db2", DataSource::class.java)
I sort of expected to have code like above, where those two database connections were created with the JDBC module (or myself manually with a hikaricp module). Point being that the "system"/jooby is able to provide jdbc connections.
In addition, I want to provide mybatis my two jdbc connections instead of using the connection pool that comes with mybatis. I thought I would end up with something like below which would be another module?
val sqlSessionFactory = require(SqlSessionFactory::class.java)
However, it seems modules dont have access to Guice or other modules/dependencies? So I am struggling to see how to put the lego pieces together.
In my current Java EE world, I would/could create CDI producers and the producer of the mybatis sqlsessionfactory would be injected with my two resources.
Long story, and I can only assume this is a common problem/pattern that has been solved already. The current documentation was not enough or in-depth enough for me to grok fully the dependency management in jooby. I see some references to serviceKey, and module vs service is fuzzy.
Hopefully this is clear enough, thanks!
Brandon