public static void init() throws Exception { ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] resources = resolver.getResources("file:" + InitConfigPath.getParamsRoot() + "/*.properties"); loadProperties(prop, resources); prop.put("params.root", InitConfigPath.getParamsRoot()); }
public static Properties getConfigFileProperties(Resource... resources) throws IOException { Properties prop = new Properties(); loadProperties(prop, resources); prop.put("params.root", InitConfigPath.getParamsRoot()); return prop; }
public static Resource getConfigFile(String fileName) { ResourceLoader loader = new DefaultResourceLoader(); return loader.getResource( "file:" + InitConfigPath.getParamsRoot() + File.separator + "files" + File.separator + fileName); }
private Resource[] getResources() throws IOException { String paramsRoot = InitConfigPath.getParamsRoot(); ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] propertiesResources = resolver.getResources("file:" + paramsRoot + "/i18n/**/*.properties"); Resource[] htmlResources = resolver.getResources("file:" + paramsRoot + "/i18n/**/*.html"); Resource[] txtResources = resolver.getResources("file:" + paramsRoot + "/i18n/**/*.txt"); List<Resource> resources = new ArrayList<Resource>(); resources.addAll(Arrays.asList(propertiesResources)); resources.addAll(Arrays.asList(htmlResources)); resources.addAll(Arrays.asList(txtResources)); return resources.toArray(new Resource[] {}); }