내가 여기 주어진 일반 텍스트 파일을로드하기위한 튜토리얼을 따라 파일 : https://github.com/spring-cloud/spring-cloud-config/blob/master/docs/src/main/asciidoc/spring-cloud-config.adoc#serving-plain-text봄 클라우드 설정 서버는
나는 설정에서 다음 URL을 테스트하는 경우가 완벽하게 작동하고, 일반 텍스트 파일 반환 제공 : http://localhost:8888/icullen-webapp/default/master/messages_en_US.properties를
그러나 설정 클라이언트에서 사용할 때 동일한 페이지에 너무 많은 번역이 있기 때문에 페이지를로드하는 데 오래 걸립니다. 이 코드는 config repo에서 번역을 찾았지만 각 번역의 경우 서버로 호출하기 때문에 상당히 느립니다.
내 코드를 보자 :<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 + "?";
}
}
번역 내용은 JSP에서 호출 내가 뭘 잘못이
<spring:message htmlEscape="true" code="category.${region.name}"/>
처럼 스프링 메시지를 사용하고 계십니까? 페이지를 빨리로드하려면 어떻게해야합니까? 우리가 붙어있는대로 도와주세요.