问题
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