1
私はutilに使用しようとしている:IOCのための一定のタグを、私は次のエラーメッセージになっています:Javaの春:エラーの取得「未知のプロパティサブ要素を<UTIL:定数>」
をスレッドで例外「メイン」org.springframework.beans.factory.BeanDefinitionStoreException:不明なプロパティサブ要素:< UTIL:「threadPoolExecutor」クラスパスリソース[spring.xml]で定義された名前を持つBeanを登録するエラー定数>
ここは私のxmlです:
<?xml version="1.0" encoding="UTF-8"?>
<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:config.properties</value>
</property>
</bean>
<bean id="main" class="pikefin.Main">
<property name="executorSample" ref="executorSample"/>
</bean>
<bean id="executorSample" class="pikefin.ExecutorSample">
<constructor-arg ref="threadPoolExecutor" />
</bean>
<bean id="threadPoolExecutor" class="java.util.concurrent.ThreadPoolExecutor">
<constructor-arg index="0" value="2"/>
<constructor-arg index="1" value="2"/>
<constructor-arg index="2" value="10"/>
<constructor-arg index="3"><util:constant static-field="java.util.concurrent.TimeUnit.SECONDS"/></constructor-arg>
<constructor-arg index="4" ref="arrayBlockingPool"/>
</bean>
<bean id="arrayBlockingPool" class="java.util.concurrent.ArrayBlockingQueue">
<constructor-arg value="5"/>
</bean>
</beans>
更新:
Invalid content was found starting with element 'util:constant'. No child element is expected at this point.
が(追記:SOで投稿する際に何らかの理由で私の書式設定のコントロールが消えている)
はここ<value>
タグと私のxmlは異なるエラーメッセージが表示されている追加されます
<?xml version="1.0" encoding="UTF-8"?> <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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>classpath:config.properties</value> </property> </bean> <bean id="main" class="pikefin.Main"> <property name="executorSample" ref="executorSample"/> </bean> <bean id="executorSample" class="pikefin.ExecutorSample"> <constructor-arg ref="threadPoolExecutor" /> </bean> <bean id="threadPoolExecutor" class="java.util.concurrent.ThreadPoolExecutor"> <constructor-arg index="0" value="2"/> <constructor-arg index="1" value="2"/> <constructor-arg index="2" value="10"/> <constructor-arg index="3"> <value> <util:constant static-field="java.util.concurrent.TimeUnit.SECONDS"/> </value> </constructor-arg> <constructor-arg index="4" ref="arrayBlockingPool"/> </bean> <bean id="arrayBlockingPool" class="java.util.concurrent.ArrayBlockingQueue"> <constructor-arg value="5"/> </bean> </beans>
私タグのフォーマット(間隔は、ラインフィード)、それはトラブル私のXSIを解析をしている場所についての何かがあるのならば、私は思ったんだけど: schemaLocationプロパティ。このスレッドにxmlファイルの先頭部分を貼り付けることはできますか? –
opike