Self-invocation behaviour in @Configuration vs. @Component classes

Regular Spring @Components For an explanation of how normal Spring (AOP) proxies or dynamic proxies (JDK, CGLIB) in general work, see my other answer with illustrative sample code. Read that first and you will understand why self-invocation cannot be intercepted for these types of proxies via Spring AOP. @Configuration classes As for @Configuration classes, they … Read more

Should I enable or disable dynamic proxies with entity framework 4.1 and MVC3?

If you talk about dynamic proxies in EF there are two different types to distinguish: Proxies for lazy loading Proxies for change tracking Usually a change tracking proxy also can serve as a proxy for lazy loading. The reverse is not true. This is because the requirements for change tracking proxies are higher, especially all … Read more

Alternatives to java.lang.reflect.Proxy for creating proxies of abstract classes (rather than interfaces)

It can be done using Javassist (see ProxyFactory) or CGLIB. Adam’s example using Javassist: I (Adam Paynter) wrote this code using Javassist: ProxyFactory factory = new ProxyFactory(); factory.setSuperclass(Dog.class); factory.setFilter( new MethodFilter() { @Override public boolean isHandled(Method method) { return Modifier.isAbstract(method.getModifiers()); } } ); MethodHandler handler = new MethodHandler() { @Override public Object invoke(Object self, Method … Read more