Grails注入的服务在cxf中作为web方法公开
我有一个使用Grails Cxf插件公开为jaxws的服务类。在我的服务中,我必须注入我在web服务中使用的另一个服务类。如果我将服务字段公开,则会生成不必要的服务方法,如下所示:Grails注入的服务在cxf中作为web方法公开,grails,dependency-injection,jax-ws,cxf,Grails,Dependency Injection,Jax Ws,Cxf,我有一个使用Grails Cxf插件公开为jaxws的服务类。在我的服务中,我必须注入我在web服务中使用的另一个服务类。如果我将服务字段公开,则会生成不必要的服务方法,如下所示: retrieveLastRecordUpdateDate setPricingContractService retrieveRecordsUpdatedFromDate retrieveAllRecordsByInsurance getPricingContractService 如果将字段设置为私有,则无法注入
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
}
class PricingContractWebService{
静态expose=EndpointType.JAX\u WS
def pricingContractService//专用?
@WebMethod(operationName=“retrieveAllRecordsByInsurance”)
@WebResult(name=“pricingContractList”)
@XmlElement(name=“healthCareCompany”,必需=true)
列表检索所有记录BYInsurance(@WebParam(partName=“HealthCareCompany”,name=“HealthCareCompany”,最终HealthCareCompany HealthCareCompany){
def pricingcontractdolist=[]
PricingContractdPolist
}
@WebMethod(operationName=“RetrievelAsterRecordUpdateDate”)
@WebResult(name=“lastUpdateDate”)
日期检索astrecordUpdateDate(){
}
@WebMethod(operationName=“retrieveRecordsUpdatedFromDate”)
@WebResult(name=“pricingContractList”)
@XmlElement(name=“updateDate”,required=true)
列表检索器ecordsupdatedfromdate(@webgram(name=“updatedatedate”)最终日期){
def pricingcontractdolist=[]
PricingContractdPolist
}
}您应该将服务端点设置为私有,并在端点声明之前添加@Autowired:
@Autowired
私人PricingContractService PricingContractService