title: How to test Spring in an application server container with Arquillian?
body: <p>We are trying to run integration tests of Spring based code on an embedded tomcat container using TestNG framework.</p>
  
  <p>We have tried to use the existing Arquillian Spring Extension without much success. Maybe some missing configuration. We have followed <a href="http://arquillian.org/blog/2012/08/17/arquillian-extension-spring-1-0-0-Beta1/" rel="nofollow">instructions from this post</a></p>
  
  <p>Our pom includes the following dependencies:</p>
  
  <pre><code>        &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.arquillian&lt;/groupId&gt;
          &lt;artifactId&gt;arquillian-bom&lt;/artifactId&gt;
          &lt;version&gt;1.0.2.Final&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
          &lt;type&gt;pom&lt;/type&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.arquillian.testng&lt;/groupId&gt;
          &lt;artifactId&gt;arquillian-testng-container&lt;/artifactId&gt;
          &lt;version&gt;1.0.2.Final&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.testng&lt;/groupId&gt;
          &lt;artifactId&gt;testng&lt;/artifactId&gt;
          &lt;version&gt;6.8&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;!-- Spring Extension --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.arquillian.extension&lt;/groupId&gt;
          &lt;artifactId&gt;arquillian-service-container-spring&lt;/artifactId&gt;
          &lt;version&gt;1.0.0.Beta1&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;!-- testing END --&gt;
  </code></pre>
  
  <p>We have also added a Tomcat embedded profile to our pom.</p>
  
  <pre><code>        &lt;profile&gt;
          &lt;id&gt;arquillian-tomcat-embedded-7&lt;/id&gt;
          &lt;activation&gt;
              &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
          &lt;/activation&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.jboss.arquillian.container&lt;/groupId&gt;
                  &lt;artifactId&gt;arquillian-tomcat-embedded-7&lt;/artifactId&gt;
                  &lt;version&gt;1.0.0.CR3&lt;/version&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat-embed-core&lt;/artifactId&gt;
                  &lt;version&gt;7.0.30&lt;/version&gt;
                  &lt;scope&gt;provided&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
                  &lt;version&gt;7.0.30&lt;/version&gt;
                  &lt;scope&gt;provided&lt;/scope&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat-juli&lt;/artifactId&gt;
                  &lt;version&gt;7.0.30&lt;/version&gt;
              &lt;/dependency&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.eclipse.jdt.core.compiler&lt;/groupId&gt;
                  &lt;artifactId&gt;ecj&lt;/artifactId&gt;
                  &lt;version&gt;3.7&lt;/version&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
  
              &lt;!-- Weld servlet for testing CDI injections --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.jboss.weld.servlet&lt;/groupId&gt;
                  &lt;artifactId&gt;weld-servlet&lt;/artifactId&gt;
                  &lt;version&gt;1.1.9.Final&lt;/version&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/profile&gt;
  </code></pre>
  
  <p>Our <code>arquillian.xml</code> looks like...</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://jboss.org/schema/arquillian"
  xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"&gt;
  
  &lt;container qualifier="tomcat" default="true"&gt;
      &lt;configuration&gt;
          &lt;property name="unpackArchive"&gt;true&lt;/property&gt;
      &lt;/configuration&gt;
  &lt;/container&gt;
  </code></pre>
  
  <p></p>
  
  <p>We also tried adding the following lines to our <code>arquillian.xml</code></p>
  
  <pre><code>&lt;extension qualifier="spring"&gt;
      &lt;property name="autoPackage"&gt;true&lt;/property&gt;
      &lt;property name="springVersion"&gt;3.0.0.RELEASE&lt;/property&gt;
      &lt;property name="cglibVersion"&gt;2.2&lt;/property&gt;
  
      &lt;property name="includeSnowdrop"&gt;true&lt;/property&gt;
      &lt;property name="snowdropVersion"&gt;2.0.3.Final&lt;/property&gt;
  
      &lt;property name="customContextClass"&gt;org.jboss.spring.vfs.context.VFSClassPathXmlApplicationContext&lt;/property&gt;
  &lt;/extension&gt;
  </code></pre>
  
  <p>We have created an empty test and check that the embedded Tomcat starts and the test is run.
  The next step is to verify that the Arquillian Spring Extension is working properly, and to do so we are trying to inject a Spring bean into our test.</p>
  
  <p>The problem is that the <code>@SpringConfiguration</code> annotation isn't available at all. So we guess we are missing some configuration. Any clues on how to proceed?</p>