title: I am trying to use spring application context and spring di in my scala vaadin app, but can't get a datasource to be injected
body: <p>i am new to scala and vaadin, i'm just experimenting. I am trying to use spring application context and spring di in my scala vaadin app, but can't get a datasource to be injected. I dont know, maybe i'm doing something fundamentally wrong but here's my code:</p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;
          /WEB-INF/applicationContext.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;
  
  &lt;context-param&gt;
      &lt;description&gt;
      Vaadin production mode&lt;/description&gt;
      &lt;param-name&gt;productionMode&lt;/param-name&gt;
      &lt;param-value&gt;false&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;Scalatest Application&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.vaadin.terminal.gwt.server.ApplicationServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;description&gt;Vaadin application class to start&lt;/description&gt;
          &lt;param-name&gt;application&lt;/param-name&gt;
          &lt;param-value&gt;com.example.scalatest.ScalaApp&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Scalatest Application&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>application context:</p>
  
  <pre><code>&lt;bean id="main" class="com.example.scalatest.ScalaApp"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;/bean&gt;
  &lt;bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"&gt;
      &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt;
      &lt;property name="url" value="url"/&gt;
      &lt;property name="username" value="root"/&gt;
      &lt;property name="password" value="pass"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>and in my scala class</p>
  
  <pre><code>var dataSource:DataSource = _;  
  def setDataSource(datasource:DataSource){
  dataSource = datasource;
  }
  </code></pre>
  
  <p>Isn't working, ds is null at launch.
  Can anyone guide me please?</p>