Guice @Nullable annotation

后端 未结 1 1770
再見小時候
再見小時候 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.<Service>of(null)) or to otherwise have some kind of provider bound that may return null.

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