/* * (non-Javadoc) * * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */ @Override public void afterPropertiesSet() throws Exception { Set<String> l = new HashSet<String>(); String i18nPattern = basePath + "/**/*.properties"; String i18nFileREG = "(" + StringUtils.join(languages, '|') + ").properties$"; if (defaultLocale != null) { Locale.setDefault(this.defaultLocale); } try { Resource[] resources = applicationContext.getResources(i18nPattern); for (Resource resource : resources) { String path = resource.getURI().toString(); if (CapString.checkRegularMatch(path, i18nFileREG)) { path = path.replaceAll(i18nFileREG, "") .replaceAll(".*/i18n/", "classpath:/i18n/") // for windows .replaceAll(".*\\\\i18n\\\\", "classpath:\\\\i18n\\\\") .replaceAll("\\\\", "/"); if (!l.contains(path)) { l.add(path); logger.debug("set message path:" + path); } } } } catch (Exception e) { logger.error(e.getMessage(), e); } super.setBasenames(l.toArray(new String[l.size()])); }