Hi
let's say, that I have to use already existing mypackage.Pizza entity and not the one created by Roo. There is also mypackage.PizzaManager interface and mypackage.PizzaManagerImpl class, that is responsible for e.g. persistence of mypackage.Pizza.
PizzaController_Roo_Controller should be modified, so that instead of
it will contain sth like thisCode:@RequestMapping(value = "/pizza", method = RequestMethod.POST) public String PizzaController.create(@Valid Pizza pizza, BindingResult result, ModelMap modelMap) { ... pizza.persist(); return "redirect:/pizza/" + pizza.getId(); }
Question is how should I inject this mypackage.PizzaManager ?Code:@RequestMapping(value = "/pizza", method = RequestMethod.POST) public String PizzaController.create(@Valid Pizza pizza, BindingResult result, ModelMap modelMap, PizzaManager pizzaManager ) { ... pizzaManager.persist(pizza); return "redirect:/pizza/" + pizza.getId(); }
Any hints are appreciated.
Thx in advance
Łukasz


Reply With Quote
. So if you annotate your PizzaManagerImpl with @Service and the service is picked up by the component scan (if it is in a registered package for component scanning as per applicationContext.xml) you can use 