I have a problem with abstract implementation of a Factory pattern on Spring. I use Spring 3 MVC and Hibernate 3, which works fine if I do not use the abstract factory method template. I'm not sure what I need to add to the controller in order to access the Factory Class (CategoryFactory).
Is there anything in the controller or bean initiative?
class SectionsController extends MultiActionController {
public ModelAndView secList() throws Exception {
CategoryFactory.CategoryType type = CategoryFactory.CategoryType.valueOf("view");
modelMap.addAttribute("sectionList", CategoryFactory.findCategory(type).list(id));
return new ModelAndView("Form", modelMap);
}
}
Factory Abstract
public abstract class Category {
public abstract List list(int departId);
}
public class CategoryFactory {
public enum CategoryType { firstclass, secondClass, ... }
public static Category findCategory(CategoryType categoryType) {
}
}
source
share