Note that there are some explanatory texts on larger screens.

plurals
  1. POAutowired bean are not handled in my Controller bean (Spring-MVC)
    primarykey
    data
    text
    <p>I create a Controller bean to map a dedicated URI.</p> <p><strong>web.xml</strong> file :</p> <pre><code> &lt;!-- Spring MVC Servlet (that will route HTTP requests to BlazeDS) --&gt; &lt;servlet&gt; &lt;servlet-name&gt;Spring MVC Dispatcher Servlet&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/spring-main-config.xml&lt;/param-value&gt; &lt;/init-param&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;!-- We are only using BlazeDS AMF channels to communicate with FlexClient, so let's map URLs accordingly. --&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Spring MVC Dispatcher Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/messagebroker/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/spring-filter-config.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;listener&gt; &lt;listener-class&gt; org.springframework.web.context.ContextLoaderListener &lt;/listener-class&gt; &lt;/listener&gt; </code></pre> <p><strong>spring-main-config.xml</strong> file : </p> <pre><code> &lt;!-- Import configuration base --&gt; &lt;import resource="spring-base-config.xml"/&gt; &lt;!-- Flex integration within Spring. --&gt; &lt;flex:message-broker services-config-path="/WEB-INF/flex-services-config.xml"&gt; &lt;flex:remoting-service /&gt; &lt;/flex:message-broker&gt; &lt;!-- Session-scoped bean for User Info --&gt; &lt;bean class="com.sharehunter.businessservices.common.UserSessionInfo" scope="session"&gt; &lt;aop:scoped-proxy proxy-target-class="false"/&gt; &lt;/bean&gt; </code></pre> <p><strong>spring-filter-config.xml</strong> file :</p> <pre><code> &lt;bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"&gt; &lt;property name="mappings"&gt; &lt;value&gt; /fbauth=myController &lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="myController" class="myapp.controller.myController" /&gt; </code></pre> <p>My bean controller file :</p> <pre><code>package myapp.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.AbstractController; public class MyController extends AbstractController{ @Autowired UserSesson userSession; @Autowired BusinessLogger logger; @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { // TO DO - Facebook authentication return null; } } </code></pre> <p>My problem : all my Autowired bean in my Controller bean is already at equal at null. I don't understand where is the issue in my configuration ...</p> <p>Thank you very much for your help !</p> <p>Anthony</p>
    singulars
    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.
 

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