title: Differences beetwen Beans configuration file and annotation use in Spring MVC?
body: <p>I am studyng Spring MVC and I have find this simple Hello World tutorial: <a href="http://www.tutorialspoint.com/spring/spring_hello_world_example.htm" rel="nofollow">http://www.tutorialspoint.com/spring/spring_hello_world_example.htm</a></p>
  
  <p>In this tutorial the author creat a <strong>Bean Configuration file</strong> named <strong>Beans.xml</strong>, something 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;bean id="helloWorld" class="com.tutorialspoint.HelloWorld"&gt;
         &lt;property name="message" value="Hello World!"/&gt;
     &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Using tis file the Spring Framework can create all the beans defined and assign them a unique ID as defined in  tag. And I can use  tag to pass the values of different variables used at the time of object creation.</p>
  
  <p>Is this the well know Bean Factory?</p>
  
  <p>My doubt is related to the following thing: in my previous example I don't use a Bean Configuration file to define my bean, but I use the annotation to define what is a Spring bean and how this bean work (for example I use <strong>@Controller</strong> annotation to say Spring that a class act as a Controller Bean)</p>
  
  <p>Use the bean configuration file and use the annotation have the same meaning?</p>
  
  <p>Can I use both?</p>
  
  <p>For example, if I have to configure JDBC can I configure it inside beans.xml file and at the same time can I use annotaions for my Controller class?</p>
  
  <p>Tnx</p>