0

SpringとのMavenプロジェクトがあります。クラスパスにjarとしてバックエンドプロジェクトがあります(maven依存関係として追加されました)。バックエンドプロジェクトは再びSpringを使用しており、独自のapplicationContext.xmlがあります。フロントエンドプロジェクトにはapplicationContext.xmlがあり、次のようにバックエンドからアプリケーションコンテキストにアクセスしたいと思います。

<import resource="classpath:applicationContext.xml" />

しかし、私は得ました:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:applicationContext.xml]
Offending resource: ServletContext resource [/WEB-INF/appContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist

また試した:

<import resource="classpath*:applicationContext.xml" />

<import resource="classpath:/applicationContext.xml" />
4

1 に答える 1

1

私が正しく理解していれば、フロントエンドがバックエンドプロジェクトのapplicationContext.xmlにアクセスするようにします。次に、classpath *が正しいステートメントであり、両方の構成ファイルの名前空間が同じであることを確認する必要があります。

たとえば、このケースは機能しません

フロントエンド:

http://www.springframework.org/schema/beans/spring-beans-3.1.xsd

バックエンド:

http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
于 2013-01-28T11:06:16.780 に答える