Hi Sudhcha,
FYI: your configuration is overkill. You should practically never need to implement ApplicationContextAware in a test class. Instead, you should just autowire your test dependencies -- you should not look them up manually via ApplicationContext.getBean(...).
In addition, @Configurable has no place in a test class!
Thus, your example should be rewritten as follows (for Spring 3.0+):
Cheers,Code:@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/com/emc/config/spring.cfg.xml") public class HelloServiceTest { @Autowired private HelloService helloService; @Test public void testHello() { helloService.sayHello("Tom"); } }
Sam


Reply With Quote
