• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring roo question for Ashish Sarin

 
Edwin Nels Johnson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ashish,

Since Spring Roo generates code for you - are there any mechanisms to protect any customization that you do to that code? If another Spring Roo command is issued to alter an entity class for example, will this wipe out any customization?

 
Ashish Sarin
author
Ranch Hand
Posts: 432
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring Roo is a smart tool, it's architecture supports code customization that can be retained.

Let's say you create a web controller using Spring Roo. The code generated by Spring Roo is split into two parts:

1. AspectJ ITD files (these are similar to Java source files but have a slight different syntax). The code in AspectJ ITDs is managed by Spring Roo. So, you must not modify methods, constructors and attributes defined in this file. This file has .aj extension.

2. Java source file. Roo will never overwrite any modifications that you make in methods, constructors and attributes of your Java source file.

Let's say you want to customize a method definied in AspectJ ITD file. You can use Push-in refactoring to move the method definition from AspectJ ITD file to the corresponding Java source file. Now, you can modify the method in the Java source file. This will ensure that your modifications are retained.

regards
ashish
 
Edwin Nels Johnson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ashish - I'm looking forward to learning more about Spring Roo and trying it out.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic