title: How to integrate Spring into Cucumber
body: <p>I am currently trying to integrate Spring into my Cucumber tests. I have a custom SpringFactory as outlined in:</p>
  
  <p><a href="http://www.zsoltfabok.com/blog/2012/01/cucumber-jvm-di/">http://www.zsoltfabok.com/blog/2012/01/cucumber-jvm-di/</a></p>
  
  <p>but the code is not being called. What is the best way to 'hook up' the factory with my tests?</p>
  
  <p>[Clarification from comment on deleted answer: the main issue is that my test has Cucumber as the main runner, i.e. @RunWith(Cucumber.class) so cannot use the SpringJUnit4ClassRunner here. This is described in the link above but there is no description of how cucumber.xml is read. I have added a new SpringFactory but it isnt reading the XML file....]</p>
  
  <p>Update: Actually have got a little further by adding:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;info.cukes&lt;/groupId&gt;
          &lt;artifactId&gt;cucumber-spring&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.RC15&lt;/version&gt;
      &lt;/dependency&gt;   
  </code></pre>
  
  <p>However, I have @Autowired variables which are not being injected as the test is being run by Cucumber.</p>
  
  <p>Has anyone else had this problem?</p>