Can the Jdbi3DaoExtension allow more than one DAO? #283
Replies: 4 comments
-
I played around with this and cannot see a nice way to allow more than one DAO without changing the existing extension's public API or adding hackery. Mainly this is because it was designed to allow testing a single DAO class, and thus has the DAO class as its generic type parameter, implying only one DAO type. Adding some other method(s) to permit getting other DAO types would be ugly and not intuitive. Since we use this in a lot of our services, I don't want to change its public API, force a major version update, etc. Instead, the best option seems to be to create a new |
Beta Was this translation helpful? Give feedback.
-
Created #321 which effectively resolves this discussion. |
Beta Was this translation helpful? Give feedback.
-
Hi GitHub, I really wish I could mark the discussion as closed somehow...why not add that feature? |
Beta Was this translation helpful? Give feedback.
-
Yay they finally added it! |
Beta Was this translation helpful? Give feedback.
-
The
Jdbi3DaoExtension
only allows us to specify a single DAO type and then get an instance of only that type. For integration tests that might use more than one DAO, is there a way to make the existing extension more generic, or create a new one that permits many DAO types?I did actually use the
Handle
provided by the extension to dohandle.attach(OtherDao.class)
and that worked in some god-awful JAX-RS resource "integration" tests that I didn't feel like modifying.So, it seems like it could support more than one DAO. The question then becomes how to integrate this nicely into the existing
Jdbi3DaoExtension
. O,r whether a new extension should be created, e.g.Jdbi3MultiDaoExtension
, though that seems a bit icky and also leads to more maintenance since it would have similar code.Beta Was this translation helpful? Give feedback.
All reactions