1

我正在使用 spring 集成,我需要包含多个 xsi:schemaLocation。

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:int="http://www.springframework.org/schema/integration"
       xmlns:int-sftp="http://www.springframework.org/schema/integration/sftp"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/integration/sftp
                           http://www.springframework.org/schema/integration/sftp/spring-integration-sftp.xsd">

部署时出现无法加载的错误:

Configuration problem: Failed to import bean definitions from relative location   
 [spring-beans.xml]
Offending resource: ServletContext resource [/WEB-INF/spring/appServlet/servlet-  
context.xml]; nested exception is  
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration
 problem: Unable to locate Spring NamespaceHandler for XML schema namespace 
 [http://www.springframework.org/schema/integration/sftp]
  Offending resource: ServletContext resource [/WEB-INF/spring/appServlet/spring-
 beans.xml]
4

1 回答 1

0

添加spring-integration-sftp到我pom.xml为我修复的这个。

<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-sftp</artifactId>
    <version>2.0.3.RELEASE</version>
</dependency>

2.0.3 可能是一个旧版本,但这是我们使用的,spring-integration-core所以我保持不变。

于 2013-08-30T15:38:36.157 回答