Hey kent,

Autowiring should work for your unit tests. You likely have a spring configuration file in your test/resources directory. If you are using Spring annotations, you can make sure that they are configured to be scanned in your test applicationContext.xml.

There is a base test class, BaseDaoTestCase that gets things setup and fires up Spring for your tests. If you changed your Spring config file names or locations you need to update this test class since it has the Spring config file locations as a static array of Strings if I remember correctly.

Other than that what are you trying to wire? What are you trying to test, DAO, Manager or Controller?

-D

On May 14, 2009, at 8:58 PM, wkbutler wrote:


Hi all -
We're using Spring bean autowiring during the regular execution of our app. I believe this is a feature of the ContextLoaderListener which is specified
in the web.xml.  That works great.

In unit testing however, autowiring is not automatically enabled.  Our
Spring contexts are getting picked up from the classpath however, same as
always.

Does anyone know how I can enable autowiring for unit testing? Seems like a configuration to the context currently being used by the unit tester, but to
be honest I have not yet figured out how the unit testing mojo is
configured.  Thanks for any pointers.

Kent


--
View this message in context: 
http://www.nabble.com/Spring-Autowiring-during-Unit-testing-tp23553006s2369p23553006.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to