CKuck CKuck - 1 year ago 247
Java Question

Spring AOP without XML

I am trying to set up Spring AOP without any XML and wonder how to enable auto-proxying this way.

Defining an AutoProxyCreator-bean works, but isn't there an easier way?

This is what my @Configuration looks like:

public class Context {
public AnnotationAwareAspectJAutoProxyCreator annotationAwareAspectJAutoProxyCreator() {
return new AnnotationAwareAspectJAutoProxyCreator();

All other beans are scanned in by

Answer Source

Spring 3.0.x doesn't provide easy ways to replace XML namespace extensions (such as <aop:aspectj-autoproxy>) in @Configuration.

An upcoming Spring 3.1 will support special annotations for this purpose, such as @EnableAspectJAutoProxy.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download