I\'m wondering if I can map this piece of xml-configuration to Spring JavaConfig:
Currently it isn't possible to translate all XML-based AspectJ settings to a Java based configuration. Probably it will never be. The main reason is that Java doesn't support method literals. But there is a workaround, which was first presented here: https://jira.springsource.org/browse/SPR-8148
- Continue using
by including the relevant XML snippet using
@ImportResource
- Convert any existing
elements to use
@Aspect
style.
Referring to the documentation, I would say that you're already nearly done with your configuration you have described above. You just have to change you config like this:
Leave the rest like it is and import that resource:
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
@Aspect
@ImportResource("classpath:/aop-config.xml")
public class AspectConfig
{
@Pointcut("@within(org.springframework.stereotype.Service)")
public void serviceAnnotatedClass() {}
}
I hope I could help...