2012-04-27 4 views
0

私はEclipse Heliosを使用しています。私は動的Webプロジェクトを持っています。Java Webプロジェクトクラスパス

私は春、私は以下の構成を使用しているため3.1.0を使用してプロパティファイルをロードしたい

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
     <property name="locations"> 
      <value>classpath:resources/dc-config.properties</value> 
     </property> 
    </bean> 

名リソースによってこのフォルダには、WEB-INF/classesディレクトリに存在している

しかしとき私はそれが今度はトンであるclassesフォルダにあるように私はクラスパスに自分のリソースフォルダIsin't次のエラー

Caused by: java.util.MissingResourceException: Can't find bundle for base name dc-config, locale en_US 

を取得し、私のTomcat 6サーバーを起動しよう彼はクラスパス?

私は多分何かここ

+0

のいずれかを試してみてください? – flash

+0

はいそれを試してみましたが、それは動作しません:-( –

答えて

0

間違ったBeanクラスをしないのです場合は私に知らせてください! 試してみてください:

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
<property name="basenames"> 
    <list> 
    <value>classpath:resources/dc-config</value> 
    </list> 
    </property> 
</bean> 
+0

これはどちらもうまくいきません!! –

+0

はログを見ると実際に春に作成されたビーンですか? – Farid

+0

こんにちは、私のコンポーネントがスキャンされなかったため、私のautowireが動作していなかった –

0

多分問題は小さなタイプミスです。あなたはあなたの特性がdc-config_en_US.propertiesファイル命名しようとしたことがあり

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
     <property name="location"> <!-- not locations --> 
      <value>classpath:resources/dc-config.properties</value> 
     </property> 
    </bean> 

または

 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
     <property name="locations"> 
     <list> 
      <value>classpath:resources/dc-config.properties</value> 
     </list> 
     </property> 
    </bean> 
関連する問題