package com.xetius.isales.pr7.service;import java.util.Arrays;import java.util.List;import javax.jws.WebService;import org.springframework.beans.factory.annotation.autowired;import com.xetius.isales.pr7.domain.PR7Product;import com.xetius.isales.pr7.domain.PR7Upgrade;import com.xetius.isales.pr7.logic.UpgradeControllerInterface;@WebService(servicename="ProductRulesService",portname="ProductRulesPort",endpointInterface="com.xetius.isales.pr7.service.ProductRulesWebService",targetnamespace="http://pr7.isales.xetius.com")public class ProductRulesWebService implements ProductRulesWebServiceInterface { @autowired private UpgradeControllerInterface upgradeController; @OverrIDe public List<PR7Product> getProducts() { if (upgradeController == null) { return Arrays.asList(new PR7Product("Fail")); } return upgradeController.getProducts(); } @OverrIDe public List<PR7Upgrade> getUpgrades() { if (upgradeController == null) { return Arrays.asList(new PR7Upgrade("Fail")); } return upgradeController.getUpgrades(); } @OverrIDe public List<PR7Product> getProductsForUpgradeWithname(String upgradename) { if (upgradeController == null) { return Arrays.asList(new PR7Product("Fail")); } return getProductsForUpgradeWithname(upgradename); }}
但是,当我尝试访问Web服务时,我收到了Fail版本,这意味着upgradeController没有自动装配.这是我的applicationContext:
<?xml version="1.0" enCoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.xetius.isales.pr7" /> <context:annotation-config /> <bean ID="upgradeController" /></beans>
如何使@WebService类具有d簧感知并自动装配发生
解决方法 如果您希望自动装配发生,ProductRulesWebService需要扩展SpringBeanautowiringSupport扩展该类将允许UpgradeController自动装配
总结以上是内存溢出为你收集整理的web-services – 如何让@WebService感知Spring全部内容,希望文章能够帮你解决web-services – 如何让@WebService感知Spring所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)