Hello all !
I migrated to 2.8.0 yesterday morning, I converted my project as I was asked to (if no, my project wasn't able to compile anymore), and now, I have this trouble :
my program is not able to make the key-value relationship anymore !
I tried two ways to manage i18n :
.1) the first one was working very fine until I updated to 2.8.0 :
- in applicationContext.xml :
Code:
<bean class="org.springframework.context.support.ResourceBundleMessageSource" id="messageSource">
Code:
<property name="basenames">
<list>
<value>WEB-INF/i18n/messages</value>
<value>WEB-INF/i18n/application</value>
<value>WEB-INF/i18n/businessMessages</value>
</list>
</property>
</bean>
Code:
<bean class="org.springframework.context.support.ReloadableResourceBundleMessageSource" id="messageSource" p:basenames="WEB-INF/i18n/messages,WEB-INF/i18n/application,WEB-INF/i18n/businessMessages" p:fallbackToSystemLocale="false" />
I know this may be redondant ... but it worked well untill yesterday. I tried to remove either one or the other but the problem is not solved.
- I have an application context manager class :
Code:
public class ApplicationContextManager implements ApplicationContextAware {
private static ApplicationContext context;
public void setApplicationContext(ApplicationContext ctx)
throws BeansException {
context = ctx;
}
public static ApplicationContext getApplicationContext() {
return context;
}
}
- and an I18nManager that just define some easy-to-remember functions :
Code:
public class I18nManager {
public static Locale getLocale() {
return LocaleContextHolder.getLocale();
}
public static String getMessage(String key, Object[] parameters) {
return ApplicationContextManager.getApplicationContext().getMessage(
key, parameters, LocaleContextHolder.getLocale());
}
(...)
}
All this was working fine, when I wanted to print a message into the expected language, I just had to do :
Code:
I18nManager.getMessage("my_key");
As this doesn't work anymore since going to 2.8.0, I tried this :
.2)
Code:
import org.springframework.context.i18n.LocaleContextHolder;
public class maClass {
@Autowired
private MessageSource messageSource;
protected void maMethode() {
System.out.println(messageSource.getMessage("ma_cle", null, LocaleContextHolder.getLocale())); }
}
But this doesn't work too 
I lost 2 days of work arround this ... so please, if anyone can help : thank you !