Archive for January, 2007

Insights of Spring IDE’s AOP support

In a previous post I gave our users some first details about what Spring IDE’s AOP support is going to offer.

Without further requirements Spring IDE will provide the following:

  • Parsing of AspectJ Pointcut Expressions in Spring configurations. Giving you error markers if the pointcut expression is syntactically incorrect. The same is true to @AspectJ-style pointcut expressions.
  • Visual markers for advised beans and advising beans and their corresponding Java classes and methods. That works for Spring AOP configuration using the <aop:config /> and <aop:advisor /> elements and for @AspectJ-style aspects and <aop:aspectj-autoproxy>.
  • To actual see what bean advises what other bean, we provide our own Beans Cross References View. This view visualizes your Spring AOP configuration and will allow the navigation between participating Spring Beans and Java classes. Furthermore the view will refresh automatically if you select another element either in the Java Editor or the Beans XML Editor and present the Beans Cross References for the selected scope.

If you have the AspectJ Development Tools installed you can get even more:

  • Reference contributions to AJDT’s Cross Reference View. Make sure that you enable Spring IDE’s provider in the view’s preferences.
  • Custom provider for AJDT’s Visualiser to see how and where your aspect and adivsors apply across your entire project.

A note about classpath settings

To allow Spring IDE to successful do the parsing of the AOP configuration, it is crucial that the project’s class path contains all required dependencies. The Spring IDE AOP parser will take your project’s classpath to load all classes from; Spring IDE will not instantiate the classes as we only need the Class. So make sure that the class path settings will allow loading an ApplicationContext from the configuration file. E.g. just execute a small JUnit to verify this; successful compilation isn’t enough as we need to load the classes including all their dependencies.

Showcasing the features

Most of you might know the JPetStore sample application and especially the implementation shipped with the Spring Framework. I’ll take this project to demonstrate the AOP support features.

First let’s start of having a look at the Spring configuration file that takes the definition of application’s business layer. Including transaction boundaries and attributes as well as some AOP demo stuff for sending emails.

If you open up the file in Eclipse you should see Spring IDE AOP markers. For the sake of consistency the icons were taken from the AJDT project. Furthermore the Beans Cross References View will display the cross references of the selected element in the xml editor. Refer to the following screen shot to get a gist how that looks.

Certainly you can use the Beans Cross References View to navigate to the Java class or method that either represents the adivce or that is actually advised. For example navigate to the PetStoreImpl.insertOrder method and you’ll see that this method is around-advised by the tx:advice and the emailAdvice. Furthermore you should find the cross references in AJDT’s cross reference view-if you have the AJDT plugins .

Last but not least you can bring up AJDT’s Visualiser and enable the Spring AOP Provider in the Visualiser’s preferences. This view can give you real quick overview of what advice is executed where in your project. Sticking with the example, only the PetStoreImpl class is advised as you can see in following screen shot.

Spring IDE 2.0 M2 released

Torsten and I are pleased to announce that the second milestone of Spring IDE 2.0 has just been released. The release is available from the developer update site at http://springide.org/updatesite_dev.

If you haven’t installed and tested the first milestone head over to New features in Spring IDE 2.0 M1 and read what you have missed so far.

To get some more details of what went into M2 check out the Release 2.0 M2 roadmap entry. Most significantly we have added some more features to the AOP support. Spring IDE now ships support for AJDT’s visualiser, inter-type declarations and Spring’s advisor concept. Talking about support for the <aop:advisor /> element it is interesting to note that Spring IDE is now capable to show you every Spring bean that is wrapped by a transactional proxy given that you use <tx:advice /> to define your transaction attributes.

I will probably post more on the AOP support later this week, incl. some screen shots.

Update: I’ve put together a new entry that demonstrates the AOP festures. You can find the entry at SpringideAopShowcase.

Spring IDE on InfoQ

The Spring IDE is nearing release of version 2.0 and Rod Johnson has posted an update on their progress. Spring IDE is a set of plugins for Eclipse that provide a GUI for Spring’s configuration files. #

Nice to see that we made on InfoQ.