|
From: Colin S. <col...@ex...> - 2004-12-04 19:33:52
|
Dion,
This already exists. Take a look at the org.springframework.test package
which is included with spring-mock.jar. In there you're find
AbstractDependencyInjectionSpringContextTests,
AbstractTransactionalSpringContextTests, and
AbstractTransactionalDataSourceSpringContextTests. They can all inject
dependencies via setter injection, or alternately field injection, and
the latter two classes also create a transaction around each test, and
roll back after each test (by default), so that your database tests can
do any kind of db work they need to, verify the results, and then the
rollback ensures the original state of the db isn't changed.
Colin
Dion Almaer wrote:
>Hi guys -
>
>Rather than having FooTest.java do getBean("someBean") it would be nice to
>just have setFooBean(...) on the test itself, and have the dependencies
>injected.
>
>I am wondering if people have done this before, and if so, how they went
>about it.
>
>Can you just create a base class which bootstraps everything and injects the
>dependencies on the subclass itself?
>
>Cheers,
>
>Dion
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://productguide.itmanagersjournal.com/
>_______________________________________________
>Springframework-developer mailing list
>Spr...@li...
>https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
|