Свойство клиента CXF SOAP не разрешается при использовании с Spring HATEOAS @EnableHypermediaSupport - PullRequest
0 голосов
/ 17 октября 2018

У меня всегда есть клиент SOAP (с использованием CXF и Spring), я недавно добавил Spring HATEOAS для управления клиентом REST.

Включая spring-hateoas и @EnableHypermediaSupport делает мой клиент Jax-ws не работающимбольше (свойство пароля больше не разрешается, давая "${ws.password}" вместо "xxxx").

Это MCVE:

Main

public class Main {
    public static void main(String... args){
        ApplicationContext ac = new ClassPathXmlApplicationContext("application-context.xml");
        MySOAPWebservice = ac.getBean(MySOAPWebservice.class);
        System.out.println(w); // when debugging, password is invalid
    }
}

MySOAPWebservice (в комплект не входит, очень простой аннотированный класс Jax-ws)

AnotherService

@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL) // comment this for everything to be ok again
@Service
public class AnotherService {
}

application.properties (не входит в комплект, определяет ws.url и ws.password)

application-context.xml

<context:property-placeholder location="application.properties" />

<context:annotation-config/>
<context:component-scan base-package="com.mypackage"/>

<jaxws:client id="soapWSClient"
              serviceClass="com.mypackage.MySOAPWebservice"
              address="${ws.url}">
    <jaxws:properties>
        <entry key="javax.xml.ws.security.auth.password">
            <value type="java.lang.String">${ws.password}</value>
        </entry>
    </jaxws:properties>
</jaxws:client>

pom.xml

<dependency>
    <groupId>org.springframework.hateoas</groupId>
    <artifactId>spring-hateoas</artifactId>
    <version>0.24.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.plugin</groupId>
    <artifactId>spring-plugin-core</artifactId>
    <version>1.2.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.1.1</version>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-frontend-jaxws</artifactId>
    <version>3.1.6</version>
</dependency>
...