guice 中的注入并不适用于任何地方

Injections in guice don't work everywhere

我正在尝试通过 Google Guice @Inject 注释注入一些服务:

 @Inject
 Service service;

此注入有效,但并非在所有地方。当它不起作用时,我会捕获空指针。有什么问题?显然,所有尝试都在单个项目中

If you do not create your instances with .getInstance() nothing will be injected. The annotation is not magic.

You have to use requestStaticInjection() on static references that are annotated with @Inject.

This is all explained in extreme detail in the Guice documentation.