Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 架构版本是否可以与jars文件不同?_Java_Xml_Spring_Jar_Xsd - Fatal编程技术网

Java 架构版本是否可以与jars文件不同?

Java 架构版本是否可以与jars文件不同?,java,xml,spring,jar,xsd,Java,Xml,Spring,Jar,Xsd,我的lib文件夹有4.0.4版本的springjar。在applicationContext.xml中,我使用模式的3.0版本 例如: 我有以下罐子: spring-beans-4.0.4 spring-context-4.0.4 弹簧芯-4.0.4 spring-expression-4.0.4 sprig-web-4.0.4 spring-webmvc-4.0.4 在applicationContext.xml中,我写道: <beans xmlns="http://www.spri

我的lib文件夹有4.0.4版本的springjar。在
applicationContext.xml
中,我使用模式的3.0版本

例如: 我有以下罐子:

  • spring-beans-4.0.4
  • spring-context-4.0.4
  • 弹簧芯-4.0.4
  • spring-expression-4.0.4
  • sprig-web-4.0.4
  • spring-webmvc-4.0.4
在applicationContext.xml中,我写道:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:util="http://www.springframework.org/schema/util" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

我的问题是:

模式和jar之间可能有不同的版本吗


如果是,后果如何

尝试在xml中使用这种模式:

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

不要这样使用:
context/spring-context-3.0.xsd
,因为当应用程序变得越来越大时,处理所有这些事情非常麻烦


如果可能,使用
maven
而不是
jars
,只需在
属性中定义一次版本
,然后仅在
依赖项的pom导入中使用该版本

是的,确实如此。有时它会抛出一个错误。因此,请尝试使用相同版本的JAR,并在xml中使用不基于版本的通用模式。谢谢您的回答。我没有使用maven,因为我必须尊重一些细节。好吧,那好吧,我只是告诉你。所以,如果您不使用maven,请记住jar的版本控制。祝你好运