Ace-T's Blog 내 검색 [네이버 커넥트 이웃 합니다~^-^/ 요청 大 환영~~]

ResourceBundleMessageSource, ReloadableResourceBundleMessageSource

OpenSource/Spring MVC 2014.04.24 10:24
[Good Comment!!, Good Discussion!!, Good Contens!!]
[ If you think that is useful, please click the finger on the bottom~^-^good~ ]
by ace-T

 

ResourceBundleMessageSource


  개요

 1차 처리

 버그??

 처 리


<< 개요 >>

ReloadableResourceBundleMessageSource 때문에 최적화 팀에서 빼달라고 연락이 왔다.

바로.. <property name="cacheSeconds" value="5" />

5초마다 계속 번들을 읽어들이고 캐시하는 옵션 때문이였다.


        

     << 1차 처리 >>

기존>

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">

<property name="basenames">

<list>

<value>WEB-INF/messages/MessageResources</value>

</list>

</property>

        <property name="cacheSeconds" value="5" />

</bean>


변경>

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">

<property name="basename">

<value>WEB-INF/messages/MessageResources</value>

</property> 

</bean>



     << 버그?? >>

번들을 찾지 못하는 오류가 났다...Why??? ㅠ _ ㅠ... 이유는 잘모르겠다..설정은 잘한것 같은데...

참고 사이트 : http://www.mkyong.com/spring/spring-resource-bundle-with-resourcebundlemessagesource-example/


     << 처 리 >>

처리는..cacheSeconds 옵션을 빼버리는것으로...처리 하였다.

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">

<property name="basenames">

<list>

<value>WEB-INF/messages/MessageResources</value>

</list>

</property>

        <property name="cacheSeconds" value="5" />  

</bean>

 


아래처럼 Default is "-1", indicating to cache forever  의 내용이므로..!!


/**

* Set the number of seconds to cache loaded properties files.

* <ul>

* <li>Default is "-1", indicating to cache forever (just like

* <code>java.util.ResourceBundle</code>).

* <li>A positive number will cache loaded properties files for the given

* number of seconds. This is essentially the interval between refresh checks.

* Note that a refresh attempt will first check the last-modified timestamp

* of the file before actually reloading it; so if files don't change, this

* interval can be set rather low, as refresh attempts will not actually reload.

* <li>A value of "0" will check the last-modified timestamp of the file on

* every message access. <b>Do not use this in a production environment!</b>

* </ul>

*/

public void setCacheSeconds(int cacheSeconds) {

this.cacheMillis = (cacheSeconds * 1000);

}



        - END -



acet 박태하가 추천하는 readtrend 추천글!

설정

트랙백

댓글

:::: facebook을 이용하시는 분들은 로그인 후 아래에 코멘트를 남겨주세요 ::::

티스토리 툴바