title: Understanding spring @Configuration class
body: <p>Following the question <a href="https://stackoverflow.com/q/19414734/2083523">Understanding Spring @Autowired usage</a> I wanted to create a complete knowledge base for the other option of spring wiring, the <code>@Configuration</code> class.</p>
  
  <p>Let's assume I have a spring XML file that looks like this:</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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;
  
    &lt;import resource="another-application-context.xml"/&gt;
  
    &lt;bean id="someBean" class="stack.overflow.spring.configuration.SomeClassImpl"&gt;
      &lt;constructor-arg value="${some.interesting.property}" /&gt;
    &lt;/bean&gt;
  
    &lt;bean id="anotherBean" class="stack.overflow.spring.configuration.AnotherClassImpl"&gt;
      &lt;constructor-arg ref="someBean"/&gt;
      &lt;constructor-arg ref="beanFromSomewhereElse"/&gt;
    &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>How can I use <code>@Configuration</code> instead? Does it have any affect on the code itself?</p>