@Nullable Ignored by guice

谁说胖子不能爱 提交于 2019-12-08 05:18:39

问题


I have a constructor like

@Inject
public FxManagerFactory(DataServicesClientAPI dsApi,
                        OptimisationHorizon horizon,
                        Logger logger,
                        ModelScenario modelScenario,
                        @Nullable LimDataProvider limDataProvider ){...}

and I am getting this error

null returned by binding at com.eet.mpm.portopt.domainmodel.modelrunners.PomModule.bindFactories(PomModule.java:171)
 but parameter 4 of com.eet.mpm.portopt.domainmodel.marketdata.FxManagerFactory.<init>() is not @Nullable
  while locating com.eet.mpm.pricecurves.LimDataProvider
    for parameter 4 at com.eet.mpm.portopt.domainmodel.marketdata.FxManagerFactory.<init>(FxManagerFactory.java:30)
  while locating com.eet.mpm.portopt.domainmodel.marketdata.FxManagerFactory
  at com.eet.mpm.portopt.domainmodel.modelrunners.PomModule.bindFactories(PomModule.java:172)
  while locating com.eet.mpm.portopt.intf.domainmodel.marketdata.IFxManager

at the second bind shown here

private void bindFactories() {
    bind(LimDataProvider.class).toProvider(LimDataProviderFactory.class).asEagerSingleton();
    bind(IFxManager.class).toProvider(FxManagerFactory.class).asEagerSingleton();  

It runs locally ('works on my pc') and when I debug it but when executed in a different environment the error occurs.

I am aware of a similar question but it seems related to eclipse which I don't think is relevant to this problem as I am not using eclipse.

来源:https://stackoverflow.com/questions/12483650/nullable-ignored-by-guice

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!