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 发现以元素PropertyPlaceHolderConfigure开头的无效内容_Java_Spring - Fatal编程技术网

Java 发现以元素PropertyPlaceHolderConfigure开头的无效内容

Java 发现以元素PropertyPlaceHolderConfigure开头的无效内容,java,spring,Java,Spring,当我将多个位置添加到属性时,出现以下错误 cvc复杂类型.2.4.d:发现以元素“value”开头的内容无效。此时不需要任何子元素 哪一个架构在max occurs中失败。?这个问题的解决方案是什么 xsi:schemaLocation=” http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springfr

当我将多个位置添加到属性时,出现以下错误

cvc复杂类型.2.4.d:发现以元素“value”开头的内容无效。此时不需要任何子元素

哪一个架构在max occurs中失败。?这个问题的解决方案是什么

xsi:schemaLocation=”
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
常数.属性
constants2.2属性

在Sotirios Delimanolis修复后更正如下

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
     <list>
        <value>constants.properties</value>
        <value>constants2.properties</value>
        <value>file:${pathl}</value>
     </list>            
    </property>
</bean>

常数.属性
constants2.2属性
文件:${pathl}

了解系统找不到${pathl}(系统找不到指定的文件)的原因。{pathl}是constants2.properties的一个属性。其中pathl=C \:Temp123.properties

您需要将
位置
更改为
位置
,这需要一个数组。然后将
元素包装在
元素中

你应该

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <array>
            <value>constants.properties</value>
            <value>constants2.properties</value>
        </array>
    </property>
</bean>

常数.属性
constants2.2属性

谢谢它正在工作,知道为什么属性文件:${pathl}没有加载吗?解决方案是什么吗?@Kasun您需要
propertyplaceholderconfigure
来解析属性。但是您正在尝试在定义
PropertyPlaceHolderConfigure
的属性之前解析该属性。那么您建议采用什么解决方案?如果我想从另一个属性文件加载属性。@Kasun属性文件的位置会改变吗?只需按字面意思输入值。文件的位置不会更改。但跨平台才是问题所在。每当我发布Linux时,我都必须更改Windows上的路径。Spring2.5分支中还有其他解决方案吗?
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <array>
            <value>constants.properties</value>
            <value>constants2.properties</value>
        </array>
    </property>
</bean>