I'm using a development environment and another production environment, in the development environment using the concept of i18N (internationalization) is correctly retrieved for example the value of label.carro
which is Carro
, however I put it on the production server ( which does not have any clients), and is returned in the caption in HTML the value label.carro
and not Carro
as it should be returned, that is, it is not reading the .properties
extension file included in the project's Java Build Path.
The same happens when retrieving a .sql
file, it returns NullPointerException
error when browsing a list with SQL files.
Following is the image of the files in Project Explorer :
Codethatretrievesfileswith.propertiesextension:
importjava.util.Locale;importorg.springframework.context.i18n.LocaleContextHolder;importorg.springframework.context.support.ResourceBundleMessageSource;publicclassMessageI18n{privateLocalelocale;publicMessageI18n(Localelocale){this.locale=locale;}publicMessageI18n(){locale=LocaleContextHolder.getLocale();}publicStringgetMessage(Stringcode){ResourceBundleMessageSourcem=newResourceBundleMessageSource();m.setBasenames("MessageI18N/ValidationMessages","MessageI18N/messages");
return m.getMessage(code, null, this.locale);
}
}
Code that retrieves SQL files, however NullPointerException error occurs while entering loop :
List<String> lst = new ArrayList<String>();
ClassLoader classLoader = getClass().getClassLoader();
File folder = new File(classLoader.getResource("dataBaseVersion").getFile());
for (final File fileEntry : folder.listFiles()) {
// Resto dos códigos
}
What puzzles me is why you can read the files in development mode but not in production mode and the settings are the same?