title: Automatically assign spring's bean name to prevent name conflicts?
body: <p>In a spring app , if two programmers develop two packages , annotating @Repository to the same class name , Spring will throw "IllegalStateException" :</p>
  
  <blockquote>
    <p>Annotation-specified bean name
    'mybean' for bean class
    [foobar.package1.mybean] conflicts
    with existing, non-compatible bean
    definition of same name and class
    [foobar.package2.mybean]</p>
  </blockquote>
  
  <p>One solution is to add extra value in the @Repository , such as <code>@Repository("package1.mybean")</code> and <code>@Repository("package2.mybean")</code> , but I am looking for a more efficient solution , that can automatically ease such situation . I hope the solution can achieve these goals :</p>
  
  <ol>
  <li><p>Programmers could arbitrarily name their bean className in his package , regardless of name conflicting with other packages(programmers). So that programmer doesn't need to yell 'Hey , I am going to use bean name XXXXX , don't conflict with me'.</p></li>
  <li><p>No manually XML bean name assign.</p></li>
  <li>If the bean name can be automatically assigned to the class's full class name , that would be great.</li>
  </ol>
  
  <p>Any ideas ? Thanks.
  (Spring 3)</p>