Search code examples
javaspringspring-mvcspring-roo

Make a static method accessible via URL with Spring MVC


I've got a Spring Roo-application (which uses Spring MVC for the scaffolded views) and I would like to execute a static method upon accessing a specific URL.

How can I pull this off?


Solution

  • How does it have to do anything with Spring Roo. I thought it was only applicable at Compile Time and not at runtime?

    In Spring MVC you can create a @Controller and then give the method @RequestMapping(value="/url", method = RequestMethod.GET) .

    Check out http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html for more reference.