java - reuse cached spring contexts to build a bigger context -
I have separate spring tests, some of them only use the entity manager and repositories but some other beans and Use unit managers and repositories Can I reuse the references created for DB tests and make only the missing part of the larger context? And so avoid expensive construction of the unit manager
Yes, this is a clever hierarchical structure for you Possible references
You can not actually deploy your production application using such a hierarchy, but for any such construction, beans in the same context, as well as the parent reference A hierarchy in can see tests in beans will allow you to avoid the functionality of reloading the JPA Entity Administrator .
In fact, you will use
@ContextHierarchy for annotation within a test class hierarchy, where (potentially
abstract ) parents test class The context is loaded defines the bean for
EntityManager .
See the section of the test chapter in the Spring Framework Reference Book.
Regards,
Sam (author of the Spring Test Contains Framework)
Comments
Post a Comment