Skip to content

Emphasise XML-driven configuration over annotations for AOP injection and configuration in documentation [SPR-2849] #7536

@spring-projects-issues

Description

@spring-projects-issues

Antranig Basman opened SPR-2849 and commented

One might be forgiven for coming to think that different parts of the Spring documentation were written by different people :P

For example, the last section of 3.3.8 includes the evaluation "The above example is generally is not a desirable solution since the business code is then aware of and coupled to the Spring Framework. Method Injection, a somewhat advanced feature of the Spring IoC container, allows this use case to be handled in a clean fashion."

This has as I see it always been one of the overriding goals of the Spring framework, that is to ensure that clients have as few dependencies as possible handed on to them. Unfortunately in the area of Java 5 annotations, there doesn't seem to be the same awareness/eagerness to ensure dependency cleanliness.

For example, section 6.4.2 on "@AspectJ or XML for Spring AOP?" gives as the headline advice "If you are using Java 5, use annotations" which is inconsistent with this philosophy. Further, section 6.8.1 shows an extensively worked example using annotations with little if any consideration given to the externally-specified (XML or other) equivalent. Whilst section 6.3 opens with a discussion of the <aop: namespace for configuration and its uses, it receives insufficient attention and enthusiasm throughout the rest of chapter 6 :P

I suggest that these sections of the documentation be reworked to show the XML-driven solution continuing as the "primary" form, with the annotation equivalent presented afterwards as an option for those who are happy with the dependency burden.

There is some discussion of this issue in the Spring forums later in this "Architecture" thread:
http://forum.springframework.org/showthread.php?t=15294&page=9


Affects: 2.0 final

1 votes, 1 watchers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions