• Post Reply Bookmark Topic Watch Topic
  • New Topic

dependency inject in web services

 
jim li
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

i have the following code:

applicationcontext.xml


<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">


<context:component-scan base-package="xxx.adapter"/>

<context:component-scan base-package="xxx.referral"/>

</beans>

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/Spring/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

</web-app>

class


@Service
@SchemaValidation(handler = MyErrorHandler.class)
@javax.jws.WebService( endpointInterface = "com.xxx.xxx.xxx.ws.wsinterface.cms2ppc.CMS2PPCServiceInterface", targetNamespace = "http://xxx.com/xxx", serviceName = "xxx", portName = "xxx")
public class CMS2PPCServiceImpl {

@Autowired
CmsToCoreReferralServiceAdapter cmsToCoreReferralServiceAdapter;
}

CmsToCoreReferralServiceAdapter class is from another project which i included it as a jar file.

CmsToCoreReferralServiceAdapterImpl is in package xxx.adapter

@Service("CmsToCoreReferralServiceAdapterImpl")
public class CmsToCoreReferralServiceAdapterImpl implements CmsToCoreReferralServiceAdapter {}

the problem is when i use cmsToCoreReferralServiceAdapter, it says it is null. please help me.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!