Wednesday, October 6, 2010

Spring Dependecy Lookup in a servlet

@Override
public void init() throws ServletException {
super.init();
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
bonusTypeRepository = (BonusTypeRepository)ctx.getBean("bonusTypeRepository");
bonusCategoryRepository = (BonusCategoryRepository)ctx.getBean("bonusCategoryRepository");
}

No comments:

Post a Comment