Annotation based Spring MVC controllers and annotations in general provide flexibility for rapid application development in today's JAVA development environment. When you combine annotations with reflection you get quick, neat and powerful solutions. Here is an example that combines a simple annotated Spring MVC form with reflection. @RequestMapping(method = RequestMethod.POST)
public String processSubmit(@ModelAttribute TestPlan testPlan, BindingResult result) {
if (result.hasErrors()) {
return "test/form";
} else {
try {
prepareTestPlan(testPlan);
// find the right method and execute it
Method[] methods = WebServiceTestForm.class.getMethods();
for (Method m : methods) {
TestDesc t = m.getAnnotation(TestDesc.class);
if (t != null && t.name() != null && t.name().equals(testPlan.getTestName())) {
...
Keeping me and perhaps you up to date with focus on technology