@RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) {
new PetValidator().validate(pet, result);
if (result.hasErrors()) {
return "petForm";
}
else {
this.clinic.storePet(pet);
status.setComplete();
return "redirect:owner.do?ownerId=" + pet.getOwner().getId();
}
}
No DI and no call to the support method!
Has Spring entered its autumn, will all the leaves be turning brown. I doubt it, Spring has a great many things to offer jee. However, Spring MVC is moving in the wrong direction right now and I hope it is corrected soon.
Tuesday, August 26, 2008
Has Spring entered its Autumn?
I'm currently working on a new web based application using Spring's contract first style web services, some jpa and simple Spring MVC client.
Up to now I've only used extension for web controllers, and mostly extending the SimpleFormController. But as this was a green field I can move up to Spring 2.5.x and with that start using annotated based pojos for my controllers.
This all started off really good, until I came to validation of the form. Previously you injected your validator and somewhere in the package hierarchy Spring would call the support method of the validator to make sure it was of the right type.
But to my horror using annotated controllers I have to call the support method manually. What happened to abstracting calls away from your implementation.
This the example of the 2.5.5 sample pet client application.
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment