A simple question that may have an extended answer.
Question: My question is, is there a way to create an instance of only the classes in the context of your application needed for this particular JUnit test?
Reason: My application context is getting pretty big. I also do a lot of integration tests, so I think you will understand when I say that every time I run the test, all classes in my application context get an instance, and this takes time.
Example:
Tell the Foo Class Only String Entry
public class Foo { @Inject Bar bar; @Test public void testrunSomeMethod() throws RegisterFault { bar.runSomeMethod(); }
but the application context has beans foobar and bar. I know this is not the context of the vaild application, but be sure all my code works.
<beans> <bean id="foobar" class="some.package.FooBar"/> <bean id="bar" class="some.package.Bar"/> <beans>
So, how do I tell spring to only instantiate the Bar and ignore the FooBar for the foo test class.
Thanks.
source share