views:

498

answers:

3

Is implementing the Abstract Factory pattern for a spring-based project with AOP should be any different than in a normal project?

A: 

Without a more concrete example, I'd have to say "no". Spring AOP is pretty good at working around your code, whatever structure it's in.

skaffman
+1  A: 

It should be simpler, all things considered; technically, Spring acts like an Abstract Factory itself, and that pattern deeply informs most things that Spring "wants" you to do with it.

McWafflestix
This is not quite correct. Spring will not add aspects to beans that it doesn't create, so creating a factory in spring and then using the factory to create things you want to be affected by aspects will fail (assuming you're using the simple spring AOP instead of AspectJ)
Jherico
A: 

Depends on your AOP. If you're using AspectJ with load time or compile time weaving, then you don't have an issue. If you're using the spring based AOP, then you have an issue because spring will only put aspects onto beans it creates. Meaning that if your factory makes the bean, it won't have any AOP instrumentation

Jherico