Perhaps this really belongs in the AOP forum, but the motivation behind it for me is persistence.
It looks like Spring only comes with an Apache Commons-Attributes implementation for letting attributes drive transactions. I had this working for a while, but then I decided to start using Java 1.5/5.0. Sadly, the attribute compiler for commons-attributes doesn't understand generics syntax, so I could no longer compile my attributes. I decided to switch from Apache attributes to Java 5 attributes. To do that, I had to write a Java 5-based implementation of Spring's org.springframework.metadata.Attributes interface. I would like to contribute this code. It seems I can't attach a tarball to this post, so please let me know how I can get this code to you, if you're interested.
This whole issue makes me think that Apache attributes are much better than Java 5 annotations. The biggest problem I found was that Java 5 annotations are not real Java classes. Therefore I couldn't use Spring's DefaultTransactionAttribute to "be" an annotation. I had to write an Annotation that represented that attribute, and then convert it to a DefaultTransactionAttribute in my implementation of the Attributes interface. Even worse, Annotations don't seem capable of defining methods (or much of anything else). Suppose I wrote a DefaultTransactionAnnotation. It would be great if I could have given it a method "asSpring" that returned a DefaultTransactionAttribute. Nope! As far as I can tell, you cannot define methods on an Annotation. Therefore, I ended up writing a separate class that converts Annotations to Spring classes. This is the big, glaring hack in my implementation. If there is any fix for it, I'd like to know!
So far I have only written code for the DefaultTransactionAttribute class, but I believe adding the others would be easy now. I just don't know them very well, because so far DefaultTransactionAttribute is all I've needed for my own project. If someone can tell me which classes control transactions, I can try writing Java 5 annotations for them. The list I see so far is RuleBasedTransactionAttribute, RollbackRuleAttribute, and NoRollbackRuleAttribute.
Anyway, please let me know how I can deliver this code. You are welcome to rename packages, classes, etc. and use it however you like.