An url
is set with something like http:xxx.com
in ..test/java/resources/application-local.properties
and ..main/java/resources/application-local.properties
A file called applicationcontext-ws.xml
used ${url}
:
<jaxws:client id="xxx"
serviceClass="RemoteService"
address="${url}">
<jaxws:outInterceptors>
<ref bean="headerInterceptor"/>
</jaxws:outInterceptors>
</jaxws:client>
When running test, I got an exception:
Caused by: java.net.URISyntaxException: Illegal character in path at index 1: ${url} at java.net.URI$Parser.fail(URI.java:2848) at java.net.URI$Parser.checkChars(URI.java:3021) at java.net.URI$Parser.parseHierarchical(URI.java:3105) at java.net.URI$Parser.parse(URI.java:3063) at java.net.URI.(URI.java:588) at org.apache.cxf.transport.http.HTTPConduit.setupURI(HTTPConduit.java:664) at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:458)
However, when running it normally, i.e., not running test, this problem never occurs.
At first I suspect that it's because ..test/resources/application-local.properties
is not loaded. I annotate a field url
with @Value(${url})
in my test class, and in debug mode I can see the field's value is exactly the url's content in ..test/resources/application-local.properties
, so that's not the cause.
Would you please offer some advice to help me figure out what's the cause and how to resove url
while running test? Thanks.