For launching the test for Spring I use @ContextConfiguration for creating beans along with context creation.
@Test
@ContextConfiguration({ "ConfigContextForTest.xml"})
The product has "a service for a Dao for a DB table" structure. Every service has many functions and many @Injected beans.
The problem is that what I am testing one function from one service, I have to declare in that ConfigContextForTest all beans, that are @Inject'ed in the service. Some of them are services, too, and inject others... so, I have to declare practically all beans of the product.
Is it really necessary? Can I make @ContextConfiguration read beans as they are injected from each other? Or maybe, I have to reorganize services, dividing them into small ones ()? Then every test will need only some beans and declarations won't be numerous.
Aucun commentaire:
Enregistrer un commentaire