GuiceApplicationLoader configuration error

前端 未结 2 982
失恋的感觉
失恋的感觉 2021-01-26 00:01

So, I\'m trying to implement compile time DI with something that looks like this:

package modules

class MyModule extends AbstractModule {
  def configure() {
           


        
2条回答
  •  梦毁少年i
    2021-01-26 00:15

    Use bindings instead of load:

    class MyApplicationLoader extends GuiceApplicationLoader {
      override protected def builder(context: ApplicationLoader.Context): GuiceApplicationBuilder = {
      initialBuilder
        .in(context.environment)
        .loadConfig(context.initialConfiguration)
        .overrides(overrides(context): _*)
        .bindings(new MyModule)
      }
    }
    

提交回复
热议问题