Test Spring Bean with Junit and loading bean definition xml
While testing Spring beans we often need to load the spring bean configuration file and inject beans into Junit Test class. Below two annotations will come handy: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration The usage of the annotations are shown in below example: /** *These two annotation will help you loan */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"/spring-config/beans.xml"}) …