Commit Graph

116 Commits

Author SHA1 Message Date
Spring Buildmaster
671f97721f Increment version to 3.1.3.BUILD-SNAPSHOT 2012-07-07 20:05:06 +02:00
Spring Buildmaster
49f728eae8 Release version 3.1.2.RELEASE 2012-07-07 17:13:55 +02:00
Chris Beams
45f1438ef8 Add hamcrest to spring-aspects Eclipse classpath
Also remove spring project nature from spring-context to avoid error in
STS.
2012-07-06 15:52:00 +02:00
Chris Beams
8bab873107 Support executor qualification with @Async#value
Prior to this change, Spring's @Async annotation support was tied to a
single AsyncTaskExecutor bean, meaning that all methods marked with
@Async were forced to use the same executor. This is an undesirable
limitation, given that certain methods may have different priorities,
etc. This leads to the need to (optionally) qualify which executor
should handle each method.

This is similar to the way that Spring's @Transactional annotation was
originally tied to a single PlatformTransactionManager, but in Spring
3.0 was enhanced to allow for a qualifier via the #value attribute, e.g.

  @Transactional(ptm1)
  public void m() { ... }

where ptm1 is either the name of a PlatformTransactionManager bean or
a qualifier value associated with a PlatformTransactionManager bean,
e.g. via the <qualifier> element in XML or the @Qualifier annotation.

This commit introduces the same approach to @Async and its relationship
to underlying executor beans. As always, the following syntax remains
supported

  @Async
  public void m() { ... }

indicating that calls to #m will be delegated to the default executor,
i.e. the executor provided to

  <task:annotation-driven executor=.../>

or the executor specified when authoring a @Configuration class that
implements AsyncConfigurer and its #getAsyncExecutor method.

However, it now also possible to qualify which executor should be used
on a method-by-method basis, e.g.

  @Async(e1)
  public void m() { ... }

indicating that calls to #m will be delegated to the executor bean
named or otherwise qualified as e1. Unlike the default executor
which is specified up front at configuration time as described above,
the e1 executor bean is looked up within the container on the first
execution of #m and then cached in association with that method for the
lifetime of the container.

Class-level use of Async#value behaves as expected, indicating that all
methods within the annotated class should be executed with the named
executor. In the case of both method- and class-level annotations, any
method-level #value overrides any class level #value.

This commit introduces the following major changes:

 - Add @Async#value attribute for executor qualification

 - Introduce AsyncExecutionAspectSupport as a common base class for
   both MethodInterceptor- and AspectJ-based async aspects. This base
   class provides common structure for specifying the default executor
   (#setExecutor) as well as logic for determining (and caching) which
   executor should execute a given method (#determineAsyncExecutor) and
   an abstract method to allow subclasses to provide specific strategies
   for executor qualification (#getExecutorQualifier).

 - Introduce AnnotationAsyncExecutionInterceptor as a specialization of
   the existing AsyncExecutionInterceptor to allow for introspection of
   the @Async annotation and its #value attribute for a given method.
   Note that this new subclass was necessary for packaging reasons -
   the original AsyncExecutionInterceptor lives in
   org.springframework.aop and therefore does not have visibility to
   the @Async annotation in org.springframework.scheduling.annotation.
   This new subclass replaces usage of AsyncExecutionInterceptor
   throughout the framework, though the latter remains usable and
   undeprecated for compatibility with any existing third-party
   extensions.

 - Add documentation to spring-task-3.2.xsd and reference manual
   explaining @Async executor qualification

 - Add tests covering all new functionality

Note that the public API of all affected components remains backward-
compatible.

Issue: SPR-9443
Backport-Issue: SPR-6847
Backport-Commit: ed0576c181
2012-06-27 23:06:54 +02:00
Chris Beams
e8006bdf78 Polish async method execution infrastructure
In anticipation of substantive changes required to implement @Async
executor qualification, the following updates have been made to the
components and infrastructure supporting @Async functionality:

 - Fix trailing whitespace and indentation errors
 - Fix generics warnings
 - Add Javadoc where missing, update to use {@code} tags, etc.
 - Avoid NPE in AopUtils#canApply
 - Organize imports to follow conventions
 - Remove System.out.println statements from tests
 - Correct various punctuation and grammar problems

Issue: SPR-9443
Backport-Issue: SPR-6847
Backport-Commit: 3fb11870d9
2012-06-27 23:06:05 +02:00
Chris Beams
6263c9abf9 Fix package cycle in @EnableSpringConfigured
@EnableSpringConfigured and its @Import'ed
SpringConfiguredConfiguration @Configuration class inadvertently
established a package cycle between beans.factory.aspectj and
context.annotation due to SpringConfiguredConfiguration's
dependency on annotations such as @Configuration, @Bean and @Role.

This commit fixes this architecture bug by moving
@EnableSpringConfigured and SpringConfiguredConfiguration from the
beans.factory.aspectj package to the context.annotation package where
they belong.

This change is assumed to be very low impact as @EnableSpringConfigured
was introduced in 3.1.0 and relocation is happening as quickly as
possible in 3.1.2. @EnableSpringConfigured is assumed to be infrequently
used at this point, and for those that are the migration path
is straightforward. When upgrading from Spring 3.1.0 or 3.1.1, update
import statements in any affected @Configuration classes to reflect the
new packaging.

Backporter's note: this change causes Bundlor warnings in
org.springframework.aspect as its manifest now "imports and exports the
package org.springframework.context.annotation". To 'solve' this
problem, `fail.on.warnings=false` has been added to build.properties.
This means that future Bundlor-based warnings may go unnoticed.

Issue: SPR-9442
Backport-Issue: SPR-9441
Backport-Commit: 5327a7a37d
2012-06-27 23:06:04 +02:00
Spring Buildmaster
b32a365f14 Increment version to 3.1.2.BUILD-SNAPSHOT 2012-02-16 15:38:16 -08:00
Spring Buildmaster
79c9ca1a26 Release version 3.1.1.RELEASE 2012-02-16 15:33:27 -08:00
Chris Beams
a9451d11f6 Relax -aspects dependence on -test (compile=>test)
The spring-aspects Maven pom had an incorrect compile-scoped dependence
on spring-test. In fact, spring-aspects only uses spring-test in its
unit tests. The pom has been updated accordingly, meaning that use
of spring-aspects in Maven-based applications will no longer require
spring-test on the classpath at runtime.

ivy.xml metadata did not need updating, as it was already correct.

This change is only necessary on the 3.1.x line; in 3.2.x (master) Maven
poms are generated automatically from Gradle dependency metadata, which
is also already correct.

Issue: SPR-9048
2012-02-04 17:49:11 +01:00
Chris Beams
87a021d5c9 Add <license> section to 3.1.x Maven poms
Issue: SPR-8927
2012-01-31 15:18:05 +01:00
Costin Leau
c39a14a130 Parse cache:annotation-driven key-generator attribute
Prior to this change, the spring-cache XSD allowed a 'key-generator'
attribute, but it was not actually parsed by AnnotationDrivenCacheBDP.

This commit adds the parsing logic as originally intended and the test
to prove it.

Issue: SPR-8939
2011-12-22 14:50:45 +01:00
Chris Beams
41c405998e Convert CRLF=>LF on files missed earlier
Complete pass with `dos2unix` found additional files missed on earlier
related commit.

Issue: SPR-5608
2011-12-22 14:06:44 +01:00
Chris Beams
88913f2b23 Convert CRLF (dos) to LF (unix)
Prior to this change, roughly 5% (~300 out of 6000+) of files under the
source tree had CRLF line endings as opposed to the majority which have
LF endings.

This change normalizes these files to LF for consistency going forward.

Command used:

$ git ls-files | xargs file | grep CRLF | cut -d":" -f1 | xargs dos2unix

Issue: SPR-5608
2011-12-21 14:52:47 +01:00
Chris Beams
e158f61e93 Increment version to 3.1.1.BUILD-SNAPSHOT 2011-12-16 11:59:06 +01:00
Chris Beams
ac107d0c2a Release Spring Framework 3.1.0.RELEASE 2011-12-13 16:35:49 +00:00
Costin Leau
312b1aa3d6 + add cache aspectj aspect 2011-12-08 13:20:01 +00:00
Costin Leau
f74789ffbe optimize AJ pointcut definition (SPR-8890) 2011-12-06 22:38:50 +00:00
Juergen Hoeller
5ab2bf16a5 fixed pointcut for type-level annotation to only apply to public methods (SPR-8890) 2011-12-06 21:14:31 +00:00
Juergen Hoeller
3a62aa053e fixed pointcut for type-level annotation to only apply to public methods (SPR-8890) 2011-12-06 21:03:57 +00:00
Juergen Hoeller
a347e4d3c2 optimized AnnotationTransactionAspect pointcut to avoid runtime checks (SPR-8890) 2011-12-06 20:48:49 +00:00
Costin Leau
1a2a3dd02a + update AJ tests 2011-12-06 14:13:29 +00:00
Costin Leau
cb3524ff30 + fix failing cache tests
+ renamed afterInvocation to beforeInvocation (and changed the docs and tests accordingly)
2011-12-06 14:05:33 +00:00
Costin Leau
d10f2258e8 + update aspectj cache aspects
+ update integration tests
2011-11-28 13:05:59 +00:00
Chris Beams
d35620511e Introduce @EnableSpringConfigured
Equivalent to <context:spring-configured/>.

Also update @EnableLoadTimeWeaving Javadoc and spring-configured XSD
documentation to reflect.

Issue: SPR-7888
2011-11-28 06:57:17 +00:00
Chris Beams
4318ccd9d5 Refactor BeanConfigurerTests
In preparation for the introduction of @EnableSpringConfigured

Issue: SPR-7888
2011-11-28 06:57:09 +00:00
Chris Beams
4f3cbb45f4 Introduce @EnableCaching
See EnableCaching Javadoc for details.

Issue: SPR-8312
2011-11-16 04:21:21 +00:00
Chris Beams
b7f9bf2e1c Polish cache Javadoc 2011-11-16 04:20:36 +00:00
Chris Beams
dacfa6993a Fix assignment error in AbstractAsyncExecutionAspect
Issue: SPR-8772
2011-10-17 18:35:27 +00:00
Costin Leau
d9de19d7b3 SPR-8653
+ refactor a bit the internals of CacheAspect to allow invocations that do not throw any exceptions (AspectJ)
2011-09-02 15:37:42 +00:00
Costin Leau
04bcd77520 + temporarily revert change 2011-09-02 08:25:39 +00:00
Costin Leau
ddfb2d3c58 + remove unneeded catch for exceptions inside AbstractCacheAspect.aj 2011-09-01 08:04:16 +00:00
Sam Brannen
1de71c6e37 [SPR-8222] Upgraded to JUnit 4.9. 2011-08-30 13:16:12 +00:00
Sam Brannen
87dad65ff0 [SPR-8622] Upgraded to JUnit 4.8.2 2011-08-18 16:06:31 +00:00
Juergen Hoeller
79ed87e3d5 updated cache aspect after CacheAspectSupport base class changes 2011-07-22 10:12:07 +00:00
Juergen Hoeller
b5520bc01a shortened build properties "org.junit.version" to "junit.version" and "org.testng.version" to "testng.version"; reverted SLF4J version back to 1.5.3 (for Hibernate 3.3.1 compatibility) 2011-06-09 13:01:09 +00:00
Chris Beams
3e5c6306be Polish @EnableAsync Javadoc and related XSD 2011-06-02 14:42:26 +00:00
Chris Beams
066daaf5be Polish @EnableTransactionManagement Javadoc and XSD 2011-06-02 14:29:06 +00:00
Costin Leau
b39673aa79 revised cache abstraction
- removed generics from Cache/CacheManager (they add no value since it's an SPI not API)
+ update docs and tests
+ renamed ConcurrentCacheFactoryBean to ConcurrentMapCacheFactoryBean
2011-05-18 18:34:41 +00:00
Costin Leau
dea1fc933f revise cache API
+ update failing AJ test
2011-05-17 17:35:01 +00:00
Costin Leau
0b917e3f9c revise cache API
- eliminate unneeded methods
+ introduced value wrapper (name still to be decided) to avoid cache race conditions
+ improved name consistency
2011-05-17 16:50:00 +00:00
Costin Leau
cc519e7c6d SPR-8334
+ commit missing configs
2011-05-13 15:59:22 +00:00
Chris Beams
01e5120a26 Introduce @EnableTransactionManagement 2011-05-06 19:10:25 +00:00
Chris Beams
de50789cb6 Introduce @EnableAsync
Introduce @EnableAsync#order

AsyncAnnotationBeanPostProcessor's 'order' property is now mutable;
@EnableAsync's 'order()' attribute allows for setting it, but must
have a default value, thus uses the new Ordered#NOT_ORDERED
constant - a reserved negative number very unlikely to be otherwise
used that may be interpreted as 'not ordered', useful in annotation
defaulting scenarios where null is not an option.

Introduce first working cut of AsyncConfiguration

Remove AsyncCapability
2011-05-06 19:08:53 +00:00
Costin Leau
08bccb28ae + revert back deleted resource 2011-03-06 18:19:19 +00:00
Costin Leau
4a589a78e1 + more configuration file 2011-03-06 17:14:10 +00:00
Costin Leau
c3a635196b SPR-8015
+ update default key generator strategy to improve compatibility for implicit declaration on one arg method
+ updated docs
2011-03-06 17:13:24 +00:00
Chris Beams
2f7c2230f0 Include license.txt and notice.txt in module JARs 2011-02-09 06:56:40 +00:00
Juergen Hoeller
efe1e64b08 fixed aspects bundle to declare dependencies for @Async aspect as well (SPR-7702) 2011-01-05 19:50:23 +00:00
Sam Brannen
b130a36af7 [SPR-7850][SPR-7851] Upgraded to JUnit 4.8.1 and TestNG 5.12.1; added changelog entries for 3.1.0.M1. 2010-12-30 08:00:58 +00:00
Costin Leau
58633e4a89 SPR-7308
+ update AJ caching test
2010-12-16 21:25:12 +00:00