Hacker News new | ask | show | jobs
by rymndhng 4425 days ago
It depends. One thing that I thought is an interesting feature of Spring, is that it allows the framework to inject code between your dependencies like decorators. This allows them to do aspect-oriented-programming transparently. And I think there's some interesting ideas here. For example, you can mark the interface of a class as @Transactional, and all your implementations will get the behavior.
1 comments

I think that's the interception way of AOP? Unity IoC in c# also does this.

The IoC container will return transparent proxy(Not the original object), which then calls the underlying method(after doing the AOP behaviour).

Be careful of using these though.

I had an obscure bug using dynamic proxy (castle dynamic proxy2) a while ago in a WPF application. I was proxying to an interface so it created a proxy object in between that in the actual class so it was eating my C# event. Changing the proxying from an interface to a subclass fixed it.

Boy that was a fun one to figure out.