SpringのDIが超べんり
warファイルの Property を war の外に出したいなぁ、と思っていると素敵な記事を発見。
http://ameblo.jp/spring-beginner/entry-10292117122.html
applicationContext.xml を以下のように記述してやればUTF-8のプロパティファイルにも対応出来ちゃう。
<!-- properties --> <bean id="testProperty" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="locations"> <list> <value>file:c:/test/test1.properties</value> <value>file:c:/test/test2.properties</value> </list> </property> <property name="fileEncoding" value="UTF-8" /> </bean>
上記、file:c の部分を Jetty の resources に出来ないかなぁ、と調査中。
(追記)ここ見るとはじめからresourcesにクラスパスが通っているっぽい。
http://wiki.eclipse.org/Jetty/Reference/Jetty_Classloading
なので file: を classpath: に変更してあげれば普通に外出しして使える。