I have a component setup that is essentially a launcher for an application. It is configured like so:
@Component public class MyLauncher { @Autowired
Look at this link
Then write your test case as
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({"/applicationContext.xml"}) public class MyLauncherTest{ @Resource private MyLauncher myLauncher ; @Test public void someTest() { //test code } }