Injecting Collection of Classes with Guice

I'm trying to inject things with Google Guice 2.0 and I have the following structure: FooAction implements Action BarAction implements Action I then have an ActionLibrary with the following constructor: ActionLibrary (List theActions) When I request an instance of ActionLibrary from Guice, I would like Guice to identify both of the registered Action classes (FooAction, BarAction) and pass them into the constructor. The motivation here being that when I add a third action BazAction, it would be as simple as registering it in the Module and it would automatically be added to the list in the constructor. Is this possible?

以上就是Injecting Collection of Classes with Guice的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准