Search code examples
spring-bootjax-wsjavabeans

Upgrade from Spring to Spring Boot broke JAX-WS client configuration


I am working on a project, and we are currently upgrading from Spring to Spring Boot. We had a JAX-WS client bean that was being autowired in a Controller, but now it says it cannot find a bean of that type. Below you can see the code snippets, I had to redact information so sorry if some naming link got broken.

We had a JAX-WS client configuration in the xml described as:

<jaxws:client id="applyClient"
              serviceClass="JaxClass"
              address="jaxAddress" >

    <jaxws:outInterceptors>
        <bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
            <constructor-arg>
                <map>
                    <entry key="action" value="Signature Timestamp"/>
                    <entry key="signatureKeyIdentifier" value="DirectReference"/>
                    <entry key="passwordType" value="PasswordText" />
                    <entry key="signaturePropFile" value="signature.properties"/>
                    <entry key="user" value="userVal" />
                    <entry key="passwordCallbackRef">
                        <ref bean="passwordCallback"/>
                    </entry>

                </map>
            </constructor-arg>
        </bean>
    ${openComment} <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" /> ${closeComment}
    </jaxws:outInterceptors>
   <jaxws:inInterceptors>
        ${openComment}<bean class="org.apache.cxf.interceptor.LoggingInInterceptor" /> ${closeComment}
    </jaxws:inInterceptors> 
</jaxws:client>

This service class is such:

@WebService(targetNamespace = "Folder", name = "TestName")
@XmlSeeAlso({Folder.ObjectFactory.class, otherFolder.ObjectFactory.class})

public interface JaxClass {

@WebResult(...)
@RequestWrapper(...)
@WebMethod
@ResponseWrapper(...)
public java.lang.String updateGBFoaInformation(
    @WebParam(...)
    Folder.FoaInformation foaInformation
) throws ExchangeRequestValidationException, ExchangeInternalErrorException;

@WebResult(...)
@RequestWrapper(...)
@WebMethod
@ResponseWrapper(...)
public method2 setGBUserSession(
    @WebParam(...)
    Folder.GBUserSessionRequest gbUserSessionRequest
) throws ExchangeRequestValidationException, 

ExchangeInternalErrorException;
}

And then in the Controller class, we had it autowired as such:

@RestController
public class TestController{

@Autowired
JaxClass applyClient;

...

This setup was working until we started upgrading. Now we get the error:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field applyClient in TestController required a bean of type 'JaxClass' that could not be found.

Action:

Consider defining a bean of type 'JaxClass' in your configuration.

Just been a bit confused, as I have spent the past week or so trying to resolve this issue. Any help or suggestions is appreciated.


Solution

  • Found the problem, while technically the xml file was in the classpath, being folder location, the application did not know to include it, so added an @ImportResource annotation and it fixed my problem.