Commit Graph

116 Commits

Author SHA1 Message Date
Juergen Hoeller b3253ca5e2 Drop mock.staticmock package from spring-aspects
Issue: SPR-14485
2016-07-19 18:56:06 +02:00
Juergen Hoeller aae4874b85 Revised spring-orm test suite (no AbstractJpaTests anymore)
Issue: SPR-13515
2016-07-19 17:50:57 +02:00
Sam Brannen 1391248ea6 Introduce log4j 2 for Spring's test suite
This commit adds a test runtime dependency on log4j 2 for every project
and migrates all log4j.properties files to log4j2-test.xml files.

Issue: SPR-14431
2016-07-05 19:19:09 +02:00
Juergen Hoeller b5db5d3aac Broadly remove deprecated core classes and methods
Issue: SPR-14430
2016-07-05 15:52:49 +02:00
Stephane Nicoll 2b822d5053 Polish contribution
Closes gh-1095
2016-07-01 10:40:54 +02:00
nkjackzhang 60123b6ca3 Fix typo in javadoc
See gh-1095
2016-07-01 10:40:15 +02:00
Juergen Hoeller 37e42e68e8 Refined AspectJ caching tests
Issue: SPR-14413
2016-06-29 10:43:54 +02:00
Stephane Nicoll 6cd85ddde7 Align caching AspectJ configuration
The `CacheResolver` and `ErrorHandler` features introduced in 4.1 were
not properly enabled in AspectJ mode. This commit adds more tests from
the regular proxy-based mode and align the AspectJ caching configuration.

Issue: SPR-14413
2016-06-29 09:21:59 +02:00
Juergen Hoeller 517ebd1d3e Consistent formatting 2016-03-24 19:22:50 +01:00
Juergen Hoeller 5025c615b1 Consistent use of AnnotatedElementUtils.findMergedAnnotation/hasAnnotation
Issue: SPR-13440
2016-03-23 18:39:20 +01:00
Juergen Hoeller f2f87ff1e0 Explicit javadoc references to BeanFactory-based default executor lookup
Issue: SPR-14030
2016-03-11 23:52:31 +01:00
Juergen Hoeller 155fa3754b Consistent lazy resolution of default executor/scheduler for Async/ScheduledAnnotationBeanPostProcessor
Issue: SPR-14030
2016-03-11 23:23:58 +01:00
Stephane Nicoll 19d97c4253 Support for multi-threaded cache access
Previously, if a `@Cacheable` method was accessed with the same key by
multiple threads, the underlying method was invoked several times instead
of blocking the threads while the value is computed. This scenario
typically affects users that enable caching to avoid calling a costly
method too often. When said method can be invoked by an arbitrary number
of clients on startup, caching has close to no effect.

This commit adds a new method on `Cache` that implements the read-through
pattern:

```
<T> T get(Object key, Callable<T> valueLoader);
```

If an entry for a given key is not found, the specified `Callable` is
invoked to "load" the value and cache it before returning it to the
caller. Because the entire operation is managed by the underlying cache
provider, it is much more easier to guarantee that the loader (e.g. the
annotated method) will be called only once in case of concurrent access.

A new `sync` attribute to the `@Cacheable` annotation has been addded.
When this flag is enabled, the caching abstraction invokes the new
`Cache` method define above. This new mode bring a set of limitations:

* It can't be combined with other cache operations
* Only one `@Cacheable` operation can be specified
* Only one cache is allowed
* `condition` and `unless` attribute are not supported

The rationale behind those limitations is that the underlying Cache is
taking care of the actual caching operation so we can't really apply
any SpEL or multiple caches handling there.

Issue: SPR-9254
2015-12-21 13:34:35 +01:00
Sam Brannen 5b3edcd9f9 Spring Cleaning in December
- Delete unused imports
- Delete unused code
- Clean up warnings
2015-12-17 20:27:33 +01:00
Juergen Hoeller dd647659b3 Rearranged cache test class names across several modules 2015-11-26 16:30:44 +01:00
Stephane Nicoll 9882a53c7d Fix test failure 2015-11-25 22:05:57 +01:00
Stephane Nicoll 2a2a8d3f93 Allow null values to be cached with `@CacheResult`
Even though the JSR-107 spec forbids to store null values, our cache
abstraction allows that behaviour with a special handled (and this is
the default behaviour).

While this was working fine with our own set of annotations, the
JSR-107 interceptor counterpart was interpreting the spec sensu strictu.

We now allow for that special case as well.

Issue: SPR-13641
2015-11-09 13:04:40 +01:00
Sam Brannen 3dcf8c1712 Simplify legacy JUnit 3.8 based tests in spring-orm
This is in preparation for a migration from JUnit 3 to JUnit 4.

Issue: SPR-13514, SPR-13515
2015-09-28 01:19:27 +02:00
Sam Brannen d5ee787e1e Migrate JUnit 3 tests to JUnit 4
This commit migrates all remaining tests from JUnit 3 to JUnit 4, with
the exception of Spring's legacy JUnit 3.8 based testing framework that
is still in use in the spring-orm module.

Issue: SPR-13514
2015-09-27 21:17:51 +02:00
Juergen Hoeller edd6e76b9f Polishing 2015-07-21 22:58:34 +02:00
Juergen Hoeller dd4bc630c3 Common code in AsyncExecutionAspectSupport allows for CompletableFuture processing with AspectJ as well
Issue: SPR-13128
2015-06-22 00:29:44 +02:00
Juergen Hoeller 581ab18b85 Test for Java 8's CompletableFuture with Spring's async execution aspect
Issue: SPR-13128
2015-06-16 21:56:17 +02:00
Sam Brannen 4dffeeee64 Introduce alias for 'value' attribute in caching annotations
This commit introduces new 'cacheNames' attributes (analogous to the
existing attribute of the same name in @CacheConfig) as aliases for the
'value' attributes in @Cacheable, @CachePut, and @CacheEvict.

In addition, SpringCacheAnnotationParser.getAnnotations() has been
refactored to support synthesized annotations.

Issue: SPR-11393
2015-05-31 22:52:01 +02:00
Sam Brannen 7f0f04dfe3 Support annotations on interfaces in AnnotatedElementUtils
This commit introduces support in AnnotatedElementUtils for finding
annotations declared on interfaces at the type level.

NB: this commit does not include support for finding annotations
declared on interface methods.

In order to maintain backward compatibility with @Transactional
annotation attribute processing, a new getAnnotationAttributes() method
has been added to AnnotatedElementUtils that provides a flag to control
whether interfaces should be searched.
SpringTransactionAnnotationParser and JtaTransactionAnnotationParser
have been updated accordingly to ensure that interfaces are not
unintentionally searched in the @Transactional resolution process.

This commit also introduces additional tests and updates TODOs for
SPR-12738.

Issue: SPR-12944, SPR-12738
2015-04-23 01:33:37 +02:00
Juergen Hoeller 8b2d9951e0 AnnotationAsyncExecutionAspect properly accepts ListenableFuture return type
Issue: SPR-12895
2015-04-15 14:57:43 +02:00
Juergen Hoeller 595cdf05e9 Polishing 2015-04-04 00:23:25 +02:00
Sam Brannen 6861d35ea0 Assemble iajc Ant task classpath w/ folders that exist
Prior to this commit, the [ant:iajc] tasks logged numerous warnings
regarding incorrect classpath entries. The reason is that the classpath
was constructed with paths that do not physically exist in the file
system (e.g., for projects that do not have test classes or test
folders (yet)).

This commit picks up where ef75bd8 left off and addresses this issue by
assembling the runtime classpath passed to the iajc task with folders
and JARs that actually exist in the filesystem.
2015-03-07 18:43:14 +01:00
Stephane Nicoll babbf6e871 Harmonize resources location
Issue: SPR-12766
2015-02-28 10:32:40 +01:00
Juergen Hoeller 2b3409461f Polishing 2015-02-27 22:29:42 +01:00
Sam Brannen ef75bd8441 Clean up classpath for iajc Ant task 2015-02-12 19:32:49 +01:00
Stephane Nicoll 66735d01cf Add exception-handler attribute support for AspectJ
Previously, the exception-handler attribute was not taken care of when
task:annotation-driven is used in AspectJ mode. This commit provides the
expected behavior.

Issue: SPR-12619
2015-02-12 15:25:51 +01:00
Stephane Nicoll fa8d202a45 AspectJ support for javax.transaction.Transactional
Issue: SPR-11803
2015-02-12 14:45:47 +01:00
Stephane Nicoll 73c21fbac1 Define JCache aspect
Align default aop.xml configuration to define the JCache aspect alongside
the regular Spring cache aspect.

 Issue: SPR-12571
2014-12-29 10:02:14 +01:00
Stephane Nicoll fd7153ffbb Do not retain cache transaction managers
Previously, cache transaction managers may be  retained outside the
boundaries of an application context with AspectJ since an aspect is
basically a singleton for the current class loader.

This commit adds a "clearTransactionManagerCache" that is similar to the
"clearMetadataCache" introduced in CacheAspectSupport: whenever the
context is disposed, the cache is cleared to remove any reference to a
transaction manager defined by that context.

Issue: SPR-12518
2014-12-16 16:26:02 +01:00
Janning Vygen 061b246307 Add @AjSuppressWarnings on static mocks
Issue: SPR-12447
2014-12-03 10:55:39 +01:00
Stephane Nicoll d9df50c6cd @Entity no longer required with spring-aspect
This commits complements 222d2b1 for another required dependency.

javax.persistence.Entity was previously required, regardless of which
aspects were actually used by the project. It is now optional and will
not break the build if it is not present. Note that the side effect is that
AnnotationDrivenStaticEntityMockingControl is disabled as well if the
JPA API is not available.

Issue: SPR-6819
2014-10-24 10:39:59 +02:00
Stephane Nicoll 222d2b1639 Fix unnecessary required spring-context-support dep
Prior to this commit, a project using compile time weaving upgrading to
4.1 was forced to add spring-context-support and the jcache API in order
to build. This problem is not new really: spring-aspects holds all
aspects provided by the framework and they all are evaluated when
compiling. 4.1 just happens to define a new aspect that requires extra
dependencies.

This commit uses a new annotation of AspectJ 1.8.3. When @RequiredTypes
is added on an aspect, it is evaluated only if the classes defined on the
annotation are actually present. If they are not, the aspect is disabled
and does not break the build.

Issue: SPR-12163
2014-10-24 10:30:24 +02:00
Juergen Hoeller 8325b10080 Consistent formatting of license headers, package javadocs, and import declarations 2014-10-21 01:44:07 +02:00
Janning Vygen 6950d5517b Adding @AjSuppressWarnings on some advices
Issue: SPR-12239
2014-10-01 16:28:21 +02:00
Juergen Hoeller 20c2ba35dc Polishing 2014-09-04 00:55:38 +02:00
Stephane Nicoll 2553fb8ba1 Apply ListenableFuture support to AspectJ
Prior to this commit, only @Async annotated methods with proxy style
had an explicit support for ListenableFuture. This commit brings that
support to AspectJ as well.

Issue: SPR-12092
2014-08-18 11:12:07 +02:00
Stephane Nicoll 8fc191c95e Apply AsyncUncaughtExceptionHandler to AspectJ
Prior to this commit, only @Async annotated methods with proxy style
had their custom uncaught exception handler applied. This commit
harmonizes the configuration so that AspectJ applies that behaviour as
well.

Issue: SPR-12090
2014-08-18 10:51:21 +02:00
Juergen Hoeller 3bcfc591e9 Polishing 2014-07-29 14:11:19 +02:00
Juergen Hoeller 8f484d382e Polishing 2014-07-29 11:42:37 +02:00
Juergen Hoeller 9f3c1cf762 Polishing 2014-07-28 23:05:08 +02:00
Juergen Hoeller 036896a6b8 Split configuration constants into local XConfigUtils classes instead of piling them up in AnnotationConfigUtils 2014-07-28 21:58:21 +02:00
Stephane Nicoll d9e0b292ab polishing 2014-07-23 17:08:19 +02:00
Juergen Hoeller 9d6c38bd54 Consistent bracket alignment 2014-07-18 17:21:58 +02:00
Stephane Nicoll 35226695eb Rename default to testCache in Cache related tests
This simply renames the default cache from "default" to "testCache" as
this might be a reserved names for third party cache providers.
2014-07-16 17:25:27 +02:00
Juergen Hoeller 3c7bb9c279 Fixed Xml/AnnotationBeanConfigurerTests after AbstractBeanConfigurerTests removal 2014-05-08 17:21:26 +02:00