Announcement Announcement Module
Collapse
No announcement yet.
Problem with @Component and auto detection. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with @Component and auto detection.

    Hi all! I seem to have run into a problem with the auto detection of beans in the classpath and can't really nail it down as it works 'sometimes' but not others. (ie, I had a test case that ran fine yesterday, and with no changes to spring config today it fails)

    I have a simple bean definition that its failing on. Something like:
    Code:
    @Repository
    @Transactional(readOnly=false)
    public class databaseThinger{
      ...
    }
    
    @Component
    public class usesDatabaseThinger(){
    
      @Resource(name='databaseThinger')
      public void set....
    }
    The useDatabaseThinger is the only place that the databaseThinger is used. The problem I am having right now is that I get the following error when I try to make my context:
    Code:
    Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'databaseThinger': Bean with name 'databaseThinger' has been injected into other beans [useDatabaseThinger] in its raw version as part of a circular reference, but has eventually been wrapped (for example as part of auto-proxy creation). This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
    If I move the definition into the XML file it seems everything works just fine and my test moves on its merry way. And what I REALLY dont understand is that this same code is working fine deployed in Tomcat, but now it wont pass the test! Test errors out, but tomcat does not. Odd.....

    Any ideas would be greatly appreciated!

  • #2
    Which version of spring are you using? If it is 2.1 M3, we got the same problem as me:

    http://opensource.atlassian.com/proj...rowse/SPR-3826

    That issue was solved on Spring 2.1 M4...

    Comment


    • #3
      Excellent! I swear I did a bunch of google searches, even searched the forums... guess I missed the JIRA search.

      Thanks for the info!
      -Nick

      Comment

      Working...
      X