Xfire发布webservice,无法通过注解注入bean,在线等。

柏了个柏 2015-05-16 10:50:07
package com.gpic.xfire.impl;

import javax.annotation.Resource;
import javax.jws.WebService;


import com.gpic.underwrite.ExecutionService;
import com.gpic.xfire.GpicService;

@WebService(serviceName = "gpicService" , endpointInterface = "com.gpic.xfire.GpicService")
public class GpicServiceImpl implements GpicService{

@Resource
ExecutionService executionService;

public String proposalValidationString(String data) throws Exception {

if(data == null || "".equals(data)) {
return "XML错误";
}

System.out.println("executionService:"+executionService);
String resultXML = executionService.underwrite(data);

return resultXML;
}

}
soapui测试输出的executionService是null
...全文
147 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
柏了个柏 2015-05-17
  • 打赏
  • 举报
回复
没有加@Service注解Spring不认识就不让使用@Resource 注解的资源吧,我是这么理解的,大家这么看?
柏了个柏 2015-05-17
  • 打赏
  • 举报
回复
加载了,我找到错误了,谢谢,是配置的问题,我整了一天。是我没有加@Service标记,这里加@Component也行
package com.gpic.xfire.impl;

import javax.annotation.Resource;
import javax.jws.WebService;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;


import com.gpic.underwrite.ExecutionService;
import com.gpic.xfire.GpicService;

@Service
@WebService(serviceName = "gpicService" , endpointInterface = "com.gpic.xfire.GpicService")
public class GpicServiceImpl implements GpicService{
	
	@Resource
	ExecutionService executionService;
	
	public String proposalValidationString(String data) throws Exception {
		
		if(data == null || "".equals(data)) {
			return "XML错误";
		}
		
		String resultXML = executionService.underwrite(data);
		
		return resultXML;
	}

}
业余草 2015-05-17
  • 打赏
  • 举报
回复
soapui测试的时候,有没有加载spring配置文件?
业余草 2015-05-17
  • 打赏
  • 举报
回复
package com.gpic.xfire.impl;

import javax.annotation.Resource;
import javax.jws.WebService;


import com.gpic.underwrite.ExecutionService;
import com.gpic.xfire.GpicService;

@WebService(serviceName = "gpicService" , endpointInterface = "com.gpic.xfire.GpicService")
public class GpicServiceImpl implements GpicService{

@Resource
ExecutionService executionService;

public String proposalValidationString(String data) throws Exception {

if(data == null || "".equals(data)) {
return "XML错误";
}

System.out.println("executionService:"+executionService);
String resultXML = executionService.underwrite(data);

return resultXML;
}

}

10,606

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧