我正在尝试在代码下方运行,但由于以下错误而失败。我无法找出问题所在。请帮忙。错误:java.lang.ArrayIndexOutOfBoundsException: 1 在第 37 行。
代码 :
package com.ugam.filter.repository;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import com.ugam.domain.filter.FilterTemplate;
@Configuration
@PropertySource("classpath:properties/filterTemplate.properties")
public class FilterTemplateRepository {
@Autowired
private Environment env;
@Bean
public Map<String,List<FilterTemplate>> getBean()
{
Map<String,List<FilterTemplate>> filterTemplateMap=new HashMap<String,List<FilterTemplate>>();
String moduleName=env.getProperty("module");
for(String eachmoduleName : moduleName.split(",")){
String templateName=env.getProperty(eachmoduleName + ".templateNames");
List<FilterTemplate> filterTemplatelist=new ArrayList<FilterTemplate>();
for (String eachtemplateNames : templateName.split(",")) {
String templateNameFields[] = env.getProperty(eachmoduleName + "." + eachtemplateNames).split(",");
FilterTemplate filterTemplate=new FilterTemplate();
filterTemplate.setTemplateHtml(templateNameFields[0]);
filterTemplate.setClassSelect(templateNameFields[1]);
filterTemplatelist.add(filterTemplate);
}
filterTemplateMap.put(eachmoduleName, filterTemplatelist);
}
return filterTemplateMap;
}
public List<FilterTemplate> getModuleData(String moduleName)
{
return getBean().get(moduleName);
}
}
属性文件:-模块=仪表板
dashboard.templateNames=templateHtml1,templateHtml2,templateHtml3,templateHtml4
dashboard.templateHtml1=dashBoardLeftInsight.html,leftpanel
dashboard.templateHtml2=dcdcsFilterOptions.html.html,
dashboard.templateHtml3=advanceFilterOptions.html,advancedOptions
dashboard.templateHtml4=reportFilterOptions.html,reportdashboard