Announcement Announcement Module
No announcement yet.
Why isn't dod autowiring? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why isn't dod autowiring?

    I started a project using roo 1.1.0. I created some entities WITHOUT testAutomatically. Later I upgraded to roo 1.1.4. Now I tried to add integration testing, using the "test integration" command. When I run "mvn test" I get the following results.

    .... Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private org.domain.JunkDataOnDemand org.domain.JunkIntegrationTest.dod;

    nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [org.domain.JunkDataOnDemand] found for dependency: ...

    I created a new roo project from scratch and created an entity with testAutomatically and it of course works. However, I cannot see the difference from my original project.

    How does roo create the DoD instances so that they are available for autowiring?

  • #2
    Note, I think this is a related post.


    • #3
      In case if helps anyone else I figured out the problem. My old as dirt spring book doesn't mention context:component-scan, but it seems that roo relies on this to register beans for auto-wiring, including the data on demand components. My project for some reason had the base-package set to one package too deep in the hierarchy. I probably did this incorrectly when setting up the initial roo project, but once I set the base package such that it would cover the data on demand components, it worked.


      • #4
        Thanks for sharing the solution; I'm sure someone will find it useful.


        • #5
          Thanks for the tips defenetly what I was looking for to get my junit test running succesfully.