From 0e734d83d5c6351aa17c42922a0a667bb838552b Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 26 Jan 2018 10:38:43 +0100 Subject: [PATCH] @EnableAspectJAutoProxy: per application context, requires aspectjweaver Issue: SPR-14753 Issue: SPR-15801 --- .../annotation/EnableAspectJAutoProxy.java | 16 +++++++++++++--- src/docs/asciidoc/core/core-aop.adoc | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/EnableAspectJAutoProxy.java b/spring-context/src/main/java/org/springframework/context/annotation/EnableAspectJAutoProxy.java index bb82665f83..4e2afc28c0 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/EnableAspectJAutoProxy.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/EnableAspectJAutoProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,8 +77,8 @@ import java.lang.annotation.Target; * // ... * } * - *

Note that {@code @Aspect} beans may be component-scanned like any other. Simply - * mark the aspect with both {@code @Aspect} and {@code @Component}: + *

Note that {@code @Aspect} beans may be component-scanned like any other. + * Simply mark the aspect with both {@code @Aspect} and {@code @Component}: * *

  * package com.foo;
@@ -101,6 +101,16 @@ import java.lang.annotation.Target;
  *     // no explicit @Bean definitions required
  * }
* + * Note: {@code @EnableAspectJAutoProxy} applies to its local application context only, + * allowing for selective proxying of beans at different levels. Please redeclare + * {@code @EnableAspectJAutoProxy} in each individual context, e.g. the common root web + * application context and any separate {@code DispatcherServlet} application contexts, + * if you need to apply its behavior at multiple levels. + * + *

This feature requires the presence of {@code aspectjweaver} on the classpath. + * While that dependency is optional for {@code spring-aop} in general, it is required + * for {@code @EnableAspectJAutoProxy} and its underlying facilities. + * * @author Chris Beams * @author Juergen Hoeller * @since 3.1 diff --git a/src/docs/asciidoc/core/core-aop.adoc b/src/docs/asciidoc/core/core-aop.adoc index e37be11e09..8743f44d56 100644 --- a/src/docs/asciidoc/core/core-aop.adoc +++ b/src/docs/asciidoc/core/core-aop.adoc @@ -235,7 +235,7 @@ as needed. The @AspectJ support can be enabled with XML or Java style configuration. In either case you will also need to ensure that AspectJ's `aspectjweaver.jar` library is on the -classpath of your application (version 1.6.8 or later). This library is available in the +classpath of your application (version 1.8 or later). This library is available in the `'lib'` directory of an AspectJ distribution or via the Maven Central repository.