Guice @Nullable annotation

后端 未结 1 1769
再見小時候
再見小時候 2021-01-19 12:36

In my service, I have a protected constructor with @Inject and one of the parameters (provider) @Nullable. Any ideas why I am getting

co         


        
1条回答
  •  离开以前
    2021-01-19 12:53

    @Nullable isn't the same as @Inject(optional=true)... I think if you want to inject null, you need to bind(Service.class).toProvider(Providers.of(null)) or to otherwise have some kind of provider bound that may return null.

    0 讨论(0)
提交回复
热议问题