Dropwizard and Guice: injecting Environment

前端 未结 3 2104
隐瞒了意图╮
隐瞒了意图╮ 2021-02-15 17:53

I am currently building a Dropwizard + Guice + Jersey-based application where the database access is being handled by JDBI for the time being.

What I am trying to achiev

3条回答
  •  萌比男神i
    2021-02-15 18:28

    We have the same configuration (dw-jdbi-guice) and also an abstract 'base' Application class which complicates things even more.

    Since a lot of things happen during run method, and many things depend on the configuration objects we ended up creating the injector in the run method. But since we need objects from bootsrap also (e.g. ObjectMapper), we ended up having a List field in the Application class. Not the prettiest solution but can handle variety of scenarios.

提交回复
热议问题