cly
cly

Reputation: 31

How to change code generation/templates in spring roo

I want to know if and how I can change the templates that generate the code in a ROO-Project.

There is a corresponding .aj-file for each controller, that is generated by ROO. I know it is possible to override the methods in the .java-file, but I don't want to do that. I would like to change the template so that all generated .aj-files contain my changes.

I've worked quite a bit with Grails. There you can use the command "install-templates". Afterwards you can completly customize the scaffolding logic to your needs. Thats exactly what I am looking for in ROO as well.

I was not able to find a solution for that. Here are some jira tickets, but I didn't understand if and how I could achieve my goal:

Any idea if that is even possible? Thanks for your help

Upvotes: 2

Views: 928

Answers (1)

jmvivo
jmvivo

Reputation: 2663

To do that, Currently, you have this options:

  • create your own add-on which creates the scaffolding as you want in the same way there are add-ons for JSF or GTK (see Simple add-on documentation and referred add-ons source code ).
  • Create an add-on that generates you own .aj files for you controllers to include you custom behaviour (see Simple add-on documentation)

This is no a easy thing. I my opinion, only If you need do this customization in some projects (more than 3 or 4 project by example) and the logic will evolve you worth create an add-on.

Good luck!

Upvotes: 1

Related Questions