Guice: Difference between Binder#bindConstant() and Binder#bind() … toInstance
问题 I would like to ask what's the difference between bindConstant().annotatedWith(Names.named("keepAliveInterval")).to(60); and bind(Integer.TYPE).annotatedWith(Names.named("keepAliveInterval")).toInstance(60); I would like to load all my configuration properties with Names.bindProperties(binder(), prop); in my module and I discovered that it uses the latter one for binding properties. Thanks, regards Marek 回答1: I think reasons to use bindConstant() are: It requires that you use an annotated