首页 新闻 赞助 找找看

关于webservice客户端接口无法被注入的问题

0
悬赏园豆:10 [待解决问题]

首先贴上代码,这个是根据服务端生成的本地客户端代码接口

package com.pudding.tcs.ctrip.testservice;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;

import org.springframework.stereotype.Component;


/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.2.4-b01
 * Generated source version: 2.2
 *
 */
@WebService(name = "testService", targetNamespace = "http://testservice.ctrip.tcs.pudding.com/")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
    ObjectFactory.class
})
public interface TestService {


    /**
     *
     * @param data
     * @return
     *     returns int
     */
    @WebMethod
    @WebResult(name = "addResponse", targetNamespace = "http://testservice.ctrip.tcs.pudding.com/", partName = "addResponse")
    public int add(
        @WebParam(name = "data", targetNamespace = "http://testservice.ctrip.tcs.pudding.com/", partName = "data")
        Data data);

}

下面是我自己写的一个controller,想在里面注入刚刚生成的接口去调用

package com.pudding.tcs.temp;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.pudding.tcs.ctrip.testservice.Data;
import com.pudding.tcs.ctrip.testservice.TestService;

@Controller
public class WsClientController {

    @Autowired
    private TestService testService;

    @RequestMapping(value="/wsclient")
    public void wsClient(){
        Data data = new Data();
        data.setA(2);
        data.setB(3);
        int add = testService.add(data);
        System.out.println(add);
    }
    
}

没有引错包,但是服务器启动的时候就报错。说这个TestService无法被注入。百思不得七姐。我用的是springboot框架。希望大婶们给解答一下波

gaoxuechaochao的主页 gaoxuechaochao | 初学一级 | 园豆:188
提问于:2016-12-03 10:54
< >
分享
所有回答(1)
0

问题解决了,哈哈,忘记读取配置文件了。所以导致无法实例化这个接口

gaoxuechaochao | 园豆:188 (初学一级) | 2016-12-03 11:12
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册