package uk.ac.ebi.atlas.trader.loader;

import org.springframework.beans.factory.annotation.Value;
import uk.ac.ebi.atlas.experimentimport.ExperimentDAO;
import uk.ac.ebi.atlas.model.baseline.BaselineExperimentBuilder;
import uk.ac.ebi.atlas.model.baseline.ExperimentalFactorsBuilder;
import uk.ac.ebi.atlas.trader.ConfigurationTrader;
import uk.ac.ebi.atlas.trader.ExperimentDesignParser;
import uk.ac.ebi.atlas.trader.SpeciesFactory;
import uk.ac.ebi.atlas.trader.SpeciesKingdomTrader;
import uk.ac.ebi.atlas.utils.ArrayExpressClient;

import javax.inject.Inject;
import javax.inject.Named;

@Named
public class ProteomicsBaselineExperimentsCacheLoaderFactory {

    @Inject
    private ConfigurationTrader configurationTrader;


    @Inject
    private SpeciesFactory speciesFactory;

    @Inject
    private ProteomicsBaselineExperimentExpressionLevelFile expressionLevelFile;

    @Inject
    private ArrayExpressClient arrayExpressClient;

    @Inject
    private ExperimentDesignParser experimentDesignParser;

    @Value("#{configuration['experiment.extra-info-image.path.template']}")
    private String extraInfoPathTemplate;

    public ProteomicsBaselineExperimentsCacheLoader create(ExperimentDAO experimentDao) {

        ProteomicsBaselineExperimentsCacheLoader loader = new ProteomicsBaselineExperimentsCacheLoader
                (expressionLevelFile, configurationTrader, speciesFactory);

        loader.setExtraInfoPathTemplate(extraInfoPathTemplate);
        loader.setExperimentDAO(experimentDao);
        loader.setArrayExpressClient(arrayExpressClient);
        loader.setExperimentDesignParser(experimentDesignParser);

        return loader;
    }

}

@@ -151,139 +151,8 @@
 AO;%0A
-import uk.ac.ebi.atlas.model.baseline.BaselineExperimentBuilder;%0Aimport uk.ac.ebi.atlas.model.baseline.ExperimentalFactorsBuilder;%0A
 impo
@@ -302,60 +302,8 @@
 ry;%0A
-import uk.ac.ebi.atlas.trader.SpeciesKingdomTrader;%0A
 impo
@@ -475,28 +475,16 @@
 tory %7B%0A%0A
-    @Inject%0A
     priv
@@ -528,30 +528,16 @@
 Trader;%0A
-%0A%0A    @Inject%0A
     priv
@@ -570,29 +570,16 @@
 Factory;
-%0A%0A    @Inject
 %0A    pri
@@ -651,29 +651,16 @@
 velFile;
-%0A%0A    @Inject
 %0A    pri
@@ -707,175 +707,1117 @@
 nt;%0A
-%0A    @Inject%0A    private ExperimentDesignParser experimentDesignParser;%0A%0A    @Value(%22#%7Bconfiguration%5B'experiment.extra-info-image.path.template'%5D%7D%22)%0A    private String
+    private ExperimentDesignParser experimentDesignParser;%0A    private String extraInfoPathTemplate;%0A%0A    @Inject%0A    public ProteomicsBaselineExperimentsCacheLoaderFactory(ConfigurationTrader configurationTrader,%0A                                                           SpeciesFactory speciesFactory,%0A                                                           ProteomicsBaselineExperimentExpressionLevelFile expressionLevelFile,%0A                                                           ArrayExpressClient arrayExpressClient,%0A                                                           ExperimentDesignParser experimentDesignParser,%0A                                                           @Value(%22#%7Bconfiguration%5B'experiment.extra-info-image.path.template'%5D%7D%22) String extraInfoPathTemplate) %7B%0A        this.configurationTrader = configurationTrader;%0A        this.speciesFactory = speciesFactory;%0A        this.expressionLevelFile = expressionLevelFile;%0A        this.arrayExpressClient = arrayExpressClient;%0A        this.experimentDesignParser = experimentDesignParser;%0A        this.extraInfoPathTemplate =
  ext
@@ -1831,24 +1831,30 @@
 athTemplate;
+%0A    %7D
 %0A%0A    public
@@ -1991,16 +1991,32 @@
 loader =
+%0A               
  new Pro
@@ -2052,16 +2052,17 @@
 heLoader
+(
 %0A       
@@ -2070,17 +2070,24 @@
         
-(
+        
 expressi

Use constructor injection instead of field injection. http://programmers.stackexchange.com/questions/300706/dependency-injection-field-injection-vs-constructor-injection http://olivergierke.de/2013/11/why-field-injection-is-evil/