Vita Rara: A Life Uncommon

Groovy Works

ApacheCon Training Session: Using Groovy with Struts 2


Categories: | | |

On Tuesday, November 13 I will be presenting a training session at ApacheCon 2007 in Atlanta, GA, Using Groovy with Struts 2. Learn how to use Groovy with Struts 2. Topics covered will include: Integrating Groovy into the Struts 2 Maven archetype; implementing actions, and service beans in Groovy; using Spring to wire Groovy service beans and action classes; using dynamic Groovy actions that do not require a server restart; writing Data Access Objects in Groovy and using Spring based transaction support with Java Persistence API (JPA).

Groovy Works 0.1 Release


Categories: | | |

Groovy Works has been the benefactor of a lot of development this past week. With upgrades for better class caching, better utilization of the GroovyClassLoader, and integration with Groovy-1.1-beta-3-SNAPSHOT and Spring 2.

Google Code Project and SVN Access

I have moved Groovy Works to Google Code. To get the latest release please see the download section on Google.

Quick Start Directions

  • Download the current release from Google Code.
  • Unzip it in a directory: tar xfzv groovyworks-0.1.tar_.gz
  • Change directory to the groovyworks-core directory: cd groovyworks-core
  • Install the Groovy Works artifact with Maven: mvn install
  • Change directory to the sample application: cd ../example-app
  • Run the application with the Jetty plugin: mvn jetty:run
  • Point your browser at http://localhost:8080/groovyworks/

To use the plugin in your Struts projects you'll need to remove the standard Struts Spring plugin. Groovy Works provides all of the functionality of the existing Spring plugin.

The Definitive Guide to Grails


Categories: | | |

I picked up a copy of The Definitive Guide to Grails this week. I'm most of the way through it, and I'm impressed. The Grails team has definitely done a lot of work. As a result I've started to dig into the code, and I'm getting a lot of ideas for Groovy Works.

Overall I highly recommend getting a copy of the book, whether you use Grails or not. It is well worth a look.

I'll post more thoughts when I finish the book.

Groovy Works


Categories: | | | |

What is Groovy Works?

Groovy Works is a marriage of the Groovy programming language, Struts 2 and the Spring Framework.

Using Groovy Works you can develop your "Java" web application and avoid time consuming re-deployments and re-starts. Using Spring's support for dynamic re-compilation of scripted beans you can simply code, save, test in your browser. No need for costly recompilation, package, deploy, restart cycles.

Right now Groovy Works exists as a Struts 2 Plug-in, and an example application. Groovy Works depends on Spring 2.0.3.

Groovy and Struts 2 Integration


Categories: | | | |

I've done more work on integrating Struts 2 and Groovy. The short news is I'm making progress. I have reloading service beans and actions sort of working. Most of the issues are Spring related (more), but I'm working through those and we'll see what comes of it. With the release of Spring 2.0.3 the AOP issues should be fixed. I haven't actually gotten to testing that yet.

Groovy Struts: Spring AOP Issues


Categories: | | | |

On the Spring forum we've been having a lively discussion about AOP support for scripted beans. Rick Evans has said the issues are not fundamental, and that he would be addressing them in the next few weeks.

I find this quite exciting. I'm really looking forward to a day when I can start my application server and just code. I'd really like to get rid of most, if not all, of the restarts.

Groovy Struts Update


Categories: | | | | |

(NB: For the latest on the subject see: Groovy Works.

I worked with using Spring to instantiate the action beans today, and that didn't go too far. I started getting an exception from AspectJ. (See thread on the Spring forum.)

So, I got to thinking. What if I created the GroovyClassLoader in Struts 2 prior to initializing the Spring context, and make the GroovyClassLoader the parent of the Spring context. This works! Finally something that works. It's not really enough though, and it's very cludgy. I would have to have two source trees, one of Groovy files that need to be compiled ahead of time, and one of others that are compiled and loaded at run time. That would make for a messy project in my eyes.

Toward a Groovy'er Struts 2


Categories: | | | |

See latest update: Groovy Works

A further update is available here.

Last week I started implementing my Struts 2 actions in Groovy. After a few days I decided I liked Groovy, but I wanted more. I didn't want to have to restart my servlet container every time I recompiled a class. I just wanted to be able to edit, save, and reload in my browser.

I researched using Spring to instantiate my actions, but Spring's scripting integration only supports singletons. So, to get around this I extended the Struts 2 Spring Plugin to integrate the GroovyClassLoader. That created problems with Spring's use of AspectJ's pointcuts to support declarative transactions. (Thread on Spring forum.)

Creating a Struts 2 Action in Groovy


Categories: | | | |

(N.B.: For the latest on Struts 2 and Groovy see: Groovy Works)

Actions in Struts 2 are POJO's. Actions also serve the same purpose of the ActionForm from Struts 1, storing all of the data submitted by your user. Additionally Struts 2 action classes store the information you wish to display back to your user. (NB: Struts 2 also supports a ModelDriven style, where the Action does not need to store this data, but the ideas are largely the same.)

Over the course of developing a Struts 2 application you will write a lot of accessors, setThis(String in), getThat(). Personally I'm sick of writing those methods. Yes, I know Eclipse could write them for me, but I don't like Eclipse, and I haven't taken the time to learn another IDE. I like my Unix shell, maven, screen and vi (vim), thank you very much.

Syndicate content