Search code examples
javaspringcode-generationspring-roo

Is it possible to customize Spring Roo app before generation?


I'm learning Spring Roo and my purpose is to add some logic in generation time. In other words, I want to add some logic not to just generated project but with commands, before generation.

For example, standard things, like authentification, adding or listing entities can be done by roo commands. Imagine, that I want to modify list items page as the following - show only such entries which have even ID field. Also, I know that it's possible to add page mapping to custom page. But is it possible to preset this custom view with command line? I mean setting form action to generated handlers, ajax quesries - making view with command not by programmers' hands.

My understanding of Roo sounds like

Roo allows you only to rapidly start standart web app's parts but any complex custom logic should be implemented by yourself, after generation.

Is my understanding correct?

Important note - I understand, that generating business logic is very bad idea. My purpose is generating custom components with Roo which is already available but my custom components more custom than currently provided authentification+CRUD. So, I'm not going to generate enterprise application I just want to generate more complex components for future using it in other complex applications.

I want to be able to do the following - remove AOP from generated app, make it simple Spring MVC app, insert pre-hardcoded requestHandlers, JSP pages with POST/GET/AJAX requests to pre-coded requests. I know, that I can write simple program which simply opens .java file and inserts my pre-coded request mappings/handlers but is there any approach to do it with Roo commands?


Solution

  • You can create your custom Spring MVC add-on which generates all you want, as you wish. Examples about it are the add-ons for GTK or Flex.

    So the answer is: yes but, to archive this, you must build your own MVC add-on. Also, if you do it, you could share it to community ;-)

    Good luck!