Wednesday, November 21, 2007

The first of many Spring kicks arse posts

In my opinion, nothing has brought life into Java development like the Spring Framework. Enterprise development in Java 4 years ago had me scratching my head. Why do I need to implement methods in this interface when I don't declare I implement it? Why do I need Entity Beans? Which of the 8 web frameworks should I be using? Why does it take so long to go from fixing a bug to actually testing that it worked? Spring has in some way, shape, or form answered all of these questions. Well except for the 8 web frameworks one.

Spring started with a couple of developers who were as frustrated as I was with the complexity inherent in Java enterprise development. Fortunately for our community, they were and are much smarter and driven than I am and they wound up with a set of tools that simplify almost every aspect of development in a Java enterprise. I think one of the keys of Spring's success has been focusing on simplifying advanced concepts and providing extremely useful tools out of the box. This example shows how Spring has simplified Aspect Oriented Programming which was a rather radical shift for Java developers in the early days of AspectJ. Additionally it provides something that 90% of all Java projects would want out of the box. Simple entered/exited logging and performance monitoring.



This code in it's current state will provide good trace logging for any bean named *DAO or *Service. Change or add the interceptor name to PerformanceTraceInterceptor and it will provide performance metrics using the JAMon performance monitoring utility. All of this provided out of the box with Spring. Stay tuned for more Spring fanboy-ism in the future.

2 comments:

Jim Holmes said...

Visual Studio has a great add in called CopySourceAsHtml which grabs prettified source code complete with styles.

That's probably of little or no value to you, but I did find mention of Java 2 Html: http://www.java2html.de/eclipse.html. (From Kenny West's blog at http://kennywest.blogspot.com/2006/11/development-convert-your-code-to-html.html)

I can't vouch for it since I used Vim and xEmacs during my Java days and didn't have such cool tools...

Todd Kaufman said...

Thanks Jim! I am back to using VS 2005 now so I grabbed the CopyAsHtml add in and tried it out. CSS issues were causing half the text to disappear so I'm leaving it as an image for now. Thanks for the help though!