spring - 如何从 wsdl 文件内的属性文件读取?

标签 spring jakarta-ee maven

我在 src/wsdl 下有 wsdl 文件,我想知道是否可以从此 wsdl 文件内的属性文件读取值,如下所示:

<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-b02-. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://AXLInterface.jaxws.AllInOne.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://AXLInterface.jaxws.AllInOne.org/" name="AXLInterfaceService">
<types>
<xsd:schema>
<xsd:import namespace="http://AXLInterface.jaxws.AllInOne.org/" schemaLocation="${wsdl.url}/AXLInterface?xsd=1"></xsd:import>
</xsd:schema>

</definitions>

我在 applicationContext 中定义了 PropertyPlaceholderConfigurer ,如下所示:

<bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:messages/application.properties</value>
                <value>file:${APP_HOME}/Common/Conf/app.properties
                </value>
            </list>
        </property>

        <property name="ignoreResourceNotFound" value="true" />
        <property name="searchSystemEnvironment" value="true" />
        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
    </bean>

当我尝试编译应用程序时,我在 wsdl 文件中遇到错误:

[ERROR] Unable to parse "${wsdl.url}/AXLInterface?xsd=1" : Illegal character in path at index 1: ${wsdl.url}/AXLInterface?xsd=1

[ERROR] java.net.URISyntaxException: Illegal character in path at index 1: ${wsdl.url}/AXLInterface?xsd=1

请告知如何实现这一点,谢谢。

最佳答案

只需将 WSDL 文件定义为资源,Maven 就会对其进行过滤。但属性值应该位于 Maven 配置文件中,而不是属性文件中。

<resource>
    <directory>src/wsdl</directory>
    <filtering>true</filtering>
</resource>

关于spring - 如何从 wsdl 文件内的属性文件读取?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13841042/

相关文章:

java - Spring 中的动态表单

java - 如何获取过滤器中的当前 Servlet 对象?

java - Spring Web 服务流程

maven - JpaRepository Querydsl : Qclass not generates

java - 从私有(private)和公共(public) maven/sbt Artifact 存储库中获取依赖项

java - 在 Spring Boot 中使用两个数据源

java - Tomcat WAR远程地址

javascript - Spring MVC、CSS 和 JavaScript 无法正常工作

java - 核心 J2EE 模式和实践是否仍然值得阅读?

java - 带logback的SLF4J还是提示failed to load class "org.slf4j.impl.StaticLoggerBinder"