I followed the tutorial for loading plain text files given here : https://github.com/spring-cloud/spring-cloud-config/blob/master/docs/src/main/asciidoc/spring-cloud-config.adoc#serving-plain-text
When I test the following url in the config serve it works perfectly and returns the plain text file : http://localhost:8888/icullen-webapp/default/master/messages_en_US.properties
However when I use in the config client, it takes ages to load my page as I have way too many translations in the same page. The code finds the translations from config repo but for each translation it makes the call to the server and hence its quite slow.
Find below my code :
<bean id="messageSource"
class="com.icullen.site.utils.TolerantReloadableResourceBundleMessageSource">
<property name="basenames" value="http://localhost:8888/icullen-webapp/default/master/messages" />
<property name="defaultEncoding" value="UTF-8" />
<property name="cacheSeconds">
<value>5</value>
</property>
</bean>
public class TolerantReloadableResourceBundleMessageSource extends
ReloadableResourceBundleMessageSource {
private static final Logger logger = LoggerFactory.getLogger(TolerantReloadableResourceBundleMessageSource.class);
@Override
protected String getMessageInternal(String code, Object[] args,
Locale locale) {
String messageInternal = super.getMessageInternal(code, args, locale);
if(messageInternal == null){
logger.warn("No translation for : {}", code);
}
return messageInternal != null ? messageInternal : "?" + code + "?";
}
}
The translations are called in the jsp using spring messages like this
<spring:message htmlEscape="true" code="category.${region.name}"/>
what am i doing wrong ? what should i do to load the page fast. Please help as we are stuck.