Maven を使用してコンパイル/ビルドする Spring Web プロジェクトがあります。プロジェクトのビルドに問題はありません。Tomcat (v6) サーバー上の Eclipse (3.3.2) でプロジェクトを実行しようとしています。
Spring プロジェクトの一部として、WEB-INF ディレクトリに spring-servlet.xml ファイルがあります。このファイルには、データソース構成を持つ別のリソース xml ファイルが含まれています。
<import resource="classpath:${datasourceInclude}.xml"/>
プロジェクトが Maven を使用してコンパイルされると、変数 ${datasourceInclude} が解決され、適切な値で設定され、適切な値を持つ spring-servlet.xml が生成されます。
<import resource="classpath:datasourceLocal.xml"/>
しかし、Eclipse (Tomcat) でプロジェクトを実行しようとすると、次のエラーが発生します。
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:${datasourceInclude}.xml]
Offending resource: ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [${datasourceInclude}.xml]; nested exception is java.io.FileNotFoundException: class path resource [${datasourceInclude}.xml] cannot be opened because it does not exist
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
...
...
基本的に、Tomcat を起動すると、${datasourceInclude} 変数を持つ /src/main/webapp/WEB-INF フォルダーから spring-servlet.xml を選択しようとします。
spring-servlet.xml を変更して ${datasourceInclude} 変数の代わりにハードコード値を追加する必要がないように、この問題を修正する方法を教えてください。