title: No XML Spring ApplicationContext
body: <p>I am trying create an project with and without spring xml configurations.</p>
  
  <p>First at all, I create my xml configuration like that:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.1.xsd"&gt;
  
  &lt;bean id="memoryManagerProduct" class="br.com.caelum.stock.ProductManager"&gt;
      &lt;constructor-arg ref="memoryProductDAO"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="memoryProductDAO" class="br.com.caelum.stock.dao.MemoryProductDAO"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>That I created my non XML configuration (I do not know if is right base in the fact that I do not know how invoke that)</p>
  
  <pre><code>package br.com.caelum.spring.config;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  
  import br.com.caelum.stock.ProductManager;
  import br.com.caelum.stock.dao.MemoryProductDAO;
  import br.com.caelum.stock.dao.Persistable;
  import br.com.caelum.stock.model.Product;
  
  @Configuration
  public class AppConfig {
  
  @Bean
  public Persistable&lt;Product&gt; memoryProductDAO(){
      return new MemoryProductDAO();
  }
  
  @Bean
  public ProductManager memoryProductManager(){
      return new ProductManager(memoryProductDAO());
  }
  }
  </code></pre>
  
  <p>Than I created an JUnit test:</p>
  
  <pre><code>package br.com.caelum.stock;
  
  import static org.hamcrest.CoreMatchers.is;
  import static org.junit.Assert.assertThat;
  
  import org.junit.Test;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  
  import br.com.caelum.stock.model.Product;
  
  public class ProductManagerTest {
  
  private ProductManager manager;
  
  @Test
  public void testSpringXMLConfiguration() {
  
      ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring.xml");
  
      manager = (ProductManager) context.getBean("memoryManagerProduct");
  
      Product product = new Product();
      product.setDescription("[Book] Spring in Action");
      product.setQuantity(10);
  
      manager.add(product);
  
      assertThat(manager.getProducts().get(0).getDescription(), is("[Book] Spring in Action"));
  }
  
  @Test
  public void testSpringWithoutXMLConfiguration() {
  
      ApplicationContext context = ?
  }
  }
  </code></pre>
  
  <p>How can I inject the configurations that are in my AppConfig to do a similar test as in my testSpringXMLConfiguration?</p>