Lately it seems like I’ve been focusing on creating Spring XML namespaces. It’s been a lot of trial and error (both on the XSD and Spring side) to get a good pattern for creating parsers. One of the biggest confusions that I ran into was the AbstractBeanDefinitionParser hierarchy. At this point it isn’t documented especially well (but there is a JIRA for it, so it’ll be fixed before GA), so I’ll give you a rundown of your choices, what they’re good for and how to use them.
The Spring Blog
This is my first post since I joined Interface21 last month. My previous blog is now officially deprecated and I won’t be updating it anymore.
So what is the subject of my first post (except to introduce myself)? Validation logic. It won’t be a walkthrough of how to perform validation in the Spring framework, rather it will discuss a particular bug bear of mine :)
In particular, I would like to discuss exactly what should go into validation logic. It seems to be a no-brainer answer; “logic to validate the specified data”. OK, that is a no-brainer but read on :).
As you know, the Spring framework provides a nice abstraction layer for your validation, via the Errors and Validator interfaces. In particular the Validator is where you apply your business specific validation rules to your populated domain object. Spring’s excellent binding support is responsible for updating your domain model based on some input, the validator is responsible for ensuring that the populated domain model is semantically correct.
So what is my bug bear? Time and time again I keep running across applications that allow validation logic to trickle out of the validator and into the controllers (for web apps), or even worse into the middle tier. Just before people start taking issue; I am not saying validation doesn’t belong in the middle tier, I am saying that the Validator is the place to put validation logic!
This is just a quick entry to let you know I have officially relocated my biz.blog to here, our new Interface21 team blog. I’m excited about this group blog serving as the voice of Interface21. For those of you who know me, you know to expect a different perspective.
I have got some saved drafts I am working on. Watch for new entries that provide insight into the business aspects of Interface21 soon…
Of all the new Spring 2.0 features and improvements, I must admit that Message-Driven POJOs are one of my personal favorites. I have a feeling that a lot of other Spring users will feel the same way.
Here I am providing a quick introduction. There is a lot more to show, and I will follow this up with other posts. For now though - this should provide you with enough information to get up and running with some truly POJO-based asynchronous JMS! I hope you are as excited about that as I am ;)
Dear Spring community,
This third release candidate includes many refinements based on valuable user feedback that we received for the previous release candidates. With this release, Spring 2.0 final is now just around the corner.
The most significant refinements include:
- Spring 1.2 compatibility has been restored for default-lazy-init="true", with respect to detection of special beans (such as PropertyPlaceholderConfigurers) by type. Alongside, lazy class loading has been reworked to allow for placeholders in class names etc. Strict lazy class loading can still be enforced for special ApplicationContexts.
An article I wrote for the InfoQ site has just gone live: Simplifying Enterprise Applications With Spring 2.0 and AspectJ.
I’ve heard a number of people saying that “AOP is too hard”, or “AOP makes things too complex”. In a way this article was written as a rebuttal of those views (hence the title, “Simplifying Enterprise Application Development”). I mean, the whole point of AOP is that you take software that was getting complex and tangled up, and you simplify the implementation by giving each module a single responsiblity again by introducing aspects. And then of course for some requirements that are naturally expressed in a crosscutting way, it’s much simpler and easier just to implement them with an aspect in the first place. The article shows how this process works, and lays out an adoption roadmap that counters the “AOP is too hard” argument - at each step along the way you can get a lot of value without having to become an AOP guru.
Spring 2.0 has added support for the JPA data access standard with all of the standard Spring support classes one would expect. Mark Fisher has a great post on how to use this new support. However one of the questions that we keep getting is why one would want to use a Spring class (JpaTemplate) to access an EntityManager. The best answer for this question lies in the value add that JpaTemplate provides. In addition to providing the one-liner convenience methods that are a hallmark of Spring data access, it also provides automatic participation in transactions and translation from PersistenceException to the Spring DataAccessException hierarchy.
Yesterday there were a few posts related to the forthcoming Beginning Spring 2 book, and I wanted to point those out here.
First, since this book will be of interest to those new to Spring - or even those who are simply curious at this point, we decided that it would be a good idea to include some discussion of common misconceptions about Spring. These have been posted here:
and on the Apress blog: http://ablog.apress.com/?p=1221.
To celebrate the launch of the new i21 team blog I take this opportunity to introduce a new Spring book that’s coming up shortly. It’s titled “Beginning Spring 2: from Novice to Professional” and is published by Apress. I’ve co-authored this book with Mark Fisher (i21), Bram Smeets (of DWR fame) and Seth Ladd (of “Expert Spring MVC and Web Flow” fame). Rob Harrop is the technical reviewer.
The book is targeted - as you might have guessed - to beginning users of the Spring Framework. Now the funny thing about Spring is that you’re always a beginner in some areas. The framework offers so much features and integrations that you can’t possible know them all (that doesn’t go for you Juergen).
There are a lot of reasons to love working at Interface21, but by far the best has to be working with the leaders of the industry. For example, one of Spring 2.0’s major focus points has been on improving AOP support. We’ve added a new configuration namespace, the AspectJ pointcut language and support for @AspectJ aspects. But this leaves a big question; what is the preferred way of writing Aspects in Spring 2.0? Since I’m an I21 employee, I have the luck of getting the answer straight from the horse’s mouth.