Note that there are some explanatory texts on larger screens.

plurals
  1. POAutowired in WS not working Spring
    primarykey
    data
    text
    <p>I have implemented a WS using Jax-ws in my server project and I'm making the calls to the service from a client application. The problem is that if I want to use @Autowire inside my @WebService annotated class it always throws the following error:</p> <p>InjectionException: Error creating managed object for class: class com.myco.wsserver.LeaveRequestEndPoint; </p> <p>if I debug that class, the reference to my autowired bean is null. if I remove the bean from my @webservice annotated class it works , also if I get the application context manually and then get the bean it also works, but I would like to know why I can't Autowire any bean.</p> <p>Here is my code.</p> <p>WebService class:</p> <pre><code>@WebService(serviceName="LeaveRequestHandler") public class LeaveRequestEndPoint extends SpringBeanAutowiringSupport{ @Autowired GenericBean mBean; public LeaveRequestEndPoint(GenericBean mBean){ this.mBean = mBean; } @WebMethod(operationName="executeOperation") public String getText() { return mBean.getText(); } } </code></pre> <p>application context:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt; &lt;!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --&gt; &lt;!-- Enables the Spring MVC @Controller programming model --&gt; &lt;annotation-driven /&gt; &lt;context:annotation-config /&gt; &lt;!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory --&gt; &lt;resources mapping="/resources/**" location="/resources/" /&gt; &lt;!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory --&gt; &lt;beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt; &lt;beans:property name="suffix" value=".jsp" /&gt; &lt;/beans:bean&gt; &lt;beans:bean id="genericBean" class="com.myco.wsserver.GenericBean"/&gt; &lt;/beans:beans&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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