Jun 18th, 2011, 10:58 PM
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?
Jun 18th, 2011, 11:17 PM
Jun 22nd, 2011, 11:37 PM
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.
Jun 23rd, 2011, 12:13 AM
Thanks for sharing the solution; I'm sure someone will find it useful.
Aug 17th, 2011, 10:23 PM
Thanks for the tips defenetly what I was looking for to get my junit test running succesfully.