Using dependency injection to get a instance of ConfigurationService

This commit is contained in:
LuizClaudioSantos
2016-04-14 09:38:01 -04:00
committed by Pascal-Nicolas Becker
parent 60f245854d
commit dc45980a5b

View File

@@ -24,6 +24,7 @@ import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Encapsulate access to the news texts.
@@ -36,12 +37,14 @@ public class NewsServiceImpl implements NewsService
private List<String> acceptableFilenames;
@Autowired(required = true)
private ConfigurationService configurationService;
public void setAcceptableFilenames(List<String> acceptableFilenames) {
this.acceptableFilenames = addLocalesToAcceptableFilenames(acceptableFilenames);
}
protected List<String> addLocalesToAcceptableFilenames(List<String> acceptableFilenames){
ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
String [] locales = configurationService.getArrayProperty("webui.supported.locales");
List<String> newAcceptableFilenames = new ArrayList<>();
newAcceptableFilenames.addAll(acceptableFilenames);