WebアプリケーションのSpringコンテキストでPropertyPlaceholderConfigurerを構成しました。これにより、特定のプロパティが構成されることを期待するJARにある他のいくつかのコンテキストがインポートされます。しかし、何らかの理由でPropertyPlaceholderConfigurerの値を使用できず、起動時にエラーが発生します。
java.net.URISyntaxException:インデックス1のパスに不正な文字があります:$ {dax.svc1.endpoint}
私のアプリケーションコンテキストは次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" name="mhpVariables">
<property name="locations">
<list>
<value>classpath:appconfig.properties</value>
</list>
</property>
</bean>
<import resource="classpath:com.test.svc1/childContext.xml"/>
<import resource="classpath:com.test.svc2/child2Context.xml"/>
</beans>
子コンテキストは次のようになります:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<!-- connection info -->
<bean class="com.test.java.framework.dataaccess.ServiceConnectionInfo" id="ConnectionInfo">
<property name="defaultUri" value="${dax.svc1.endpoint}"/>
<property name="maxTotalConnections" value="500"/>
<property name="maxConnectionsPerHost" value="50"/>
<property name="readTimeout" value="3000"/>
<property name="ConnectionTimeout" value="1000"/>
</bean>
</beans>
プロパティファイルがクラスパス上にあり、プロパティがあることを確認しましたdax.svc1.endpoint
。ここで何が欠けていますか?