Some times i need to modify generate .aj file
eg. to_string file i no need to show id and version
but after i modify .aj file spring roo will convert to
original generate file
any body who face the same situation ?
thanks for all answer
Some times i need to modify generate .aj file
eg. to_string file i no need to show id and version
but after i modify .aj file spring roo will convert to
original generate file
any body who face the same situation ?
thanks for all answer
Do not modify the generated AspectJ source code. These files are intended to be maintained by Roo.
If you want to change the toString() behaviour, implement toString() in the relevant Java source file. Spring Roo is smart enough to detect that and avoid generating its own generic toString() method.
thanks a lot for your answer
you mean all roo generate .aj file is detected change by roo
and if i modify it roo will convert it to original automatically.
And i have another question it's cover to Controller ?
if i need my own method i should coding it in to java instead
.aj file rigth?
As Rod mentioned, the AspectJ (.aj) files are actively maintained by Spring Roo. You as the developer should not customize anything directly in an aj file since Roo will simply override it again if the shell is running.
If you need to customize anything you can simply use the 'push-in' refactoring feature in the SpringSource Tool Suite to move the relevant method or field back into your normal Java type (.java) where you can freely customize it. You can also do this by hand. Roo will recognize any method in your java source which has the same signature and therefore not provide the method in the aj file.
This applies to all java types which are accompanied by aspects, so yes the same principle applies to MVC Controllers.
HTH,
Stefan
Stefan Schmidt
Software Engineer, Spring Roo
SpringSource - a division of VMware
twitter @schmidtstefan
Thankz a lot.
I modified my Myclass_Roo_JavaBean.aj file by searching within my IDE for one of the properties in Myclass.
I was forced to do it because Roo was not adding the getter and setter for a field I just added to Myclass via the Roo command shell.
I've decided to do a Refactor->Push In and get out of using Roo/AspectJ altogether.
The failure of Roo to update the .aj files as I make changes to entity classes has cost me too much development time spent figuring out why a getter for an entity member could not be found, why an entityManager object was not injected, etc. I read somewhere else on this forum that Roo/AspectJ gets corrupted after repeated usage.
Still, I credit Roo for getting me started on Spring 3 development faster than I would have otherwise.
Hi Paolo, Is you Roo engine running? Perhaps you can restart it. On startup Roo checks all roo artifacts and updates the corresponding .aj if necessary.I was forced to do it because Roo was not adding the getter and setter for a field I just added to Myclass via the Roo command shell.
Yes, the Roo Shell was running inside my STS environment. I restarted STS several times before I decided to do the Push In Refactor.