Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring @Autowired is not working for @WebService annotated class
    text
    copied!<p>Getting null pointer while trying to autowire. </p> <p>Creating a Web application and using following webservices:</p> <p><strong>WebServiceEndpoint.java</strong></p> <pre><code>@WebService @Component public class ChannelMapWebServiceEndpoint { @Autowired ChannelMapWebService webservice; public ChannelMapInfo4[] getMaps() throws RemoteException { return this.webservice.getMaps(); } } </code></pre> <p><strong>ChannelMapsebserviceImpl.java</strong></p> <pre><code>@Service public class ChannelMapWebServiceImpl implements ChannelMapWebService { public ChannelMapInfo4[] getMaps() throws RemoteException { System.out.println("hi"); } } </code></pre> <p><strong>application context.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;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"&gt; &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="ccad" /&gt; &lt;context:component-scan base-package="channelmapwebservice" /&gt; &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="locations"&gt; &lt;value&gt;/WEB-INF/jdbc.properties&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt; &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt; &lt;property name="url" value="${jdbc.url}"/&gt; &lt;property name="username" value="${jdbc.username}"/&gt; &lt;property name="password" value="${jdbc.password}"/&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre> <p>I am getting the autowired object webservice as null while trying to connect through SoapUI.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload