我想使用PropertyPlaceHolderConfigurer动态地将内部Web服务的WSDL URL传递到Spring beans.xml中。Spring PropertyPlaceholderConfigurer不替换占位符
这里是场景:
我的web应用程序部署在WebLogic 10.3中。 WSDL url包含在属性文件之外我的应用程序(直接位于相应的域文件夹下,而我的应用程序位于自动部署文件夹内)。我设置该属性的位置在我的域名的文件的setDomainEnv.cmd文件象下面这样:
set JAVA_PROPERTIES=%JAVA_PROPERTIES% %CLUSTER_PROPERTIES% -Dproperty.file.path.config=%DOMAIN_HOME%\Service.properties
这是我的Service.properties文件包含:
Service.WSDL.PATH=http://localhost:8088/mockServiceSoap?WSDL
我的春天的beans.xml配置:----
<bean id="file.path" class="java.lang.System" factory-method="getProperty">
<constructor-arg index="0"><value>property.file.path.config</value></constructor-arg>
</bean>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" ref="file.path"/>
</bean>
<bean id="myServiceId" class="com.test.service.ServiceImpl">
<property name="myServiceSoap">
<ref bean="myService"/>
</property>
</bean>
<bean id="myService" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
<property name="serviceInterface" value="com.test.service.ServiceSoap"/>
<property name="wsdlDocumentUrl" value="${Service.WSDL.PATH}"/>
</bean>
我启用了调试日志专门为PPC,这是我在我的应用程序日志中看到:
INFO org.springframework.beans.factory.config.PropertyPlaceholderConfigurer 178 - Loading properties file from URL [file:D:/bea10.3/user_projects/domains/my_domain/Service.properties]
因此,虽然Service.properties文件正在通过PPC加载,但${Service.WSDL.PATH}
未被替换。
我在这里做错了什么?
另外,我怎么知道PPC是否试图替换占位符的值以及什么值?我希望日志文件包含该信息,但没有任何内容。
任何帮助表示赞赏。
尝试:ServletContextPropertyPlaceholderConfigurer - 但我不知道它是否有所作为 – Ralph
您是否遇到应用程序启动异常,或者属性没有被替换? – Ralph