【发布时间】:2013-05-16 06:02:08
【问题描述】:
我有一个使用 Grails Cxf 插件公开为 jaxws 的服务类。在我的服务中,我必须注入另一个在我的 Web 服务中使用的服务类。如果我公开服务字段,我会生成如下不必要的服务方法:
retrieveLastRecordUpdateDate
setPricingContractService
retrieveRecordsUpdatedFromDate
retrieveAllRecordsByInsurance
getPricingContractService
如果我将字段设为私有,我将无法注入服务类。如何既注入服务又不将其公开为 Web 服务?简化代码如下:
class PricingContractWebService {
static expose = EndpointType.JAX_WS
def pricingContractService // private?
@WebMethod( operationName="retrieveAllRecordsByInsurance" )
@WebResult( name="pricingContractList" )
@XmlElement(name="healthCareCompany", required=true)
List<PricingContractDTO> retrieveAllRecordsByInsurance(@WebParam(partName = "HealthCareCompany", name = "healthCareCompany", ) final HealthCareCompany healthCareCompany) {
def pricingContractDTOList = []
pricingContractDTOList
}
@WebMethod( operationName="retrieveLastRecordUpdateDate" )
@WebResult( name="lastUpdateDate" )
Date retrieveLastRecordUpdateDate() {
}
@WebMethod( operationName="retrieveRecordsUpdatedFromDate" )
@WebResult( name="pricingContractList" )
@XmlElement(name="updateDate", required=true)
List<PricingContractDTO> retrieveRecordsUpdatedFromDate(@WebParam(name = "updateDate") final Date date) {
def pricingContractDTOList = []
pricingContractDTOList
}
}
【问题讨论】:
标签: grails dependency-injection jax-ws cxf