是否可以将Jax-WS与Generic接口一起使用?

时间:2015-06-18 07:07:11

标签: jaxb jax-ws

如何使用Jax-WS的通用通用接口?

public interface IGenericWebService<T extends Record> {
    @WebMethod
    public List<T> listAll();      
}

如何在不重写方法的情况下使其工作?

@WebService
public interface IWCustomerService extends IGenericWebService<Customer>{
    /* 
    @WebMethod  
    public List<Customer> listAll(); */
}

常见实施

public abstract class GenericWebService<T extends Record> implements IGenericWebService<T>{
    protected static Log log = LogFactory.getLog(GenericWebService.class);
}

客户服务

@WebService(endpointInterface="com.dev.bridge.iwservices.IWCustomerService")
@Service
public class WCustomerService extends GenericWebService<Customer> implements IWCustomerService{
    @Autowired
    private ICustomerService customerService;
    public List<Customer> listAll() {
        try {
            return customerService.listAll();           
        } catch (CoreException e) {
            log.error(e.getMessage(), e);
        }
        return new ArrayList<Customer>();
    }
}

0 个答案:

没有答案