Commit Graph

174 Commits

Author SHA1 Message Date
Juergen Hoeller 51252ebbca Avoid defensive checks against Java 8 API (java.util.Optional etc)
This commit also fixes broken javadoc links and code references.

Issue: SPR-13188
2016-07-05 02:09:00 +02:00
Juergen Hoeller ff6ead1fff Remove Velocity support
Issue: SPR-13795
2016-07-04 23:30:58 +02:00
Juergen Hoeller 81057a2cee Require EhCache 2.10+
Issue: SPR-13794
2016-07-04 23:22:32 +02:00
Johnny Lim 44e652f99e Remove duplicate words
Closes gh-1039
2016-04-19 08:24:21 +02:00
Juergen Hoeller 4ae065996b Polishing
(cherry picked from commit aa5c12c)
2016-04-08 23:06:25 +02:00
Juergen Hoeller 157dcab56c Cleanup of remaining direct BeanWrapper usage
Issue: SPR-14121
2016-04-07 14:27:22 +02:00
Juergen Hoeller 6db6f23a04 Quartz ResourceLoaderClassLoadHelper explicitly falls back to classpath lookup
Issue: SPR-13706
2016-04-05 12:18:48 +02:00
Juergen Hoeller 8bfba6a07a EhCacheManagerFactoryBean logs cache manager name
Issue: SPR-14110
2016-04-04 14:56:08 +02:00
Juergen Hoeller 14bf6509ec Consistent cache key implementation across transaction and cache attribute sources
Includes consistent applicability of class-level metadata to user-level methods only.

Issue: SPR-14017
Issue: SPR-14095
2016-03-30 14:13:04 +02:00
Juergen Hoeller a68b910b7c TimerScheduledFuture correctly calculates getDelay result
Issue: SPR-13977
2016-02-24 17:11:36 +01:00
Juergen Hoeller 25be5e060c TaskDecorator callback supported by common TaskExecutor implementations
Issue: SPR-13930
2016-02-17 16:58:02 +01:00
Stephane Nicoll aed56ea732 Upgrade to Caffeine 2.1.0 2016-01-28 16:50:29 +01:00
Stephane Nicoll 29700658d4 Support Quartz trigger without JobDetail
This commit allows to create a Quartz trigger implementation via
either `CronTriggerFactoryBean` or `SimpleTriggerFactoryBean` even if no
job detail is provided.

Issue: SPR-13604
2016-01-19 18:03:03 +01:00
Juergen Hoeller 773d175681 Polishing 2016-01-13 12:52:05 +01:00
Stephane Nicoll 7d0ebddebe Flag Caffeine as Java8+ only
See also SPR-13824
2015-12-28 15:06:35 +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
Stephane Nicoll 3a238a2b61 Polish contribution
Closes gh-921

Issue: SPR-13690
2015-12-18 15:47:13 +01:00
Ben Manes 13aabeef37 Add caching support for Caffeine
Issue: SPR-13690
2015-12-18 15:47:13 +01:00
Juergen Hoeller a2a9c47e59 Deprecate Velocity support
Issue: SPR-13235
2015-12-17 17:15:57 +01:00
Juergen Hoeller 8ce5e88c66 Require Jackson 2.6+, FreeMarker 2.3.21+, XStream 1.4.5+
Issue: SPR-13062
2015-12-17 17:14:50 +01:00
Juergen Hoeller dd647659b3 Rearranged cache test class names across several modules 2015-11-26 16:30:44 +01:00
Stephane Nicoll bf1afdfdc9 Add cache tests for JCache 2015-11-24 10:15:09 +01:00
Stephane Nicoll 610b5a20ea Fix test name 2015-11-23 18:22:53 +01:00
Stephane Nicoll 8dea3c5ade Remove test duplication 2015-11-23 18:19:58 +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
Juergen Hoeller 112781fb47 Reliable null value handling in ConcurrentMapCache, GuavaCache, JCacheCache
The 4.2 variant of this fix includes a common AbstractValueAdaptingCache base class and a common NullValue holder class.

Issue: SPR-13553
2015-10-09 22:55:18 +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 525d111210 Polishing 2015-09-24 16:43:26 +02:00
Juergen Hoeller e05fb494f5 Polishing 2015-08-26 11:04:14 +02:00
Juergen Hoeller 3a5cc3df80 JCacheEhCache3Tests enforces EhCache 3.0's CachingProvider
Issue: SPR-13342
2015-08-12 23:09:16 +02:00
Juergen Hoeller d8794a1edc Test against EhCache 3.0 M2 (as a JCache provider)
Includes latest dependency updates (Jackson 2.6.1, Jetty 9.3.2, Undertow 1.2.10)

Issue: SPR-13342
2015-08-12 16:16:25 +02:00
Sam Brannen 6c530b7bfb Delete trailing whitespace in XML files 2015-06-19 17:14:10 +02:00
Juergen Hoeller b4095c3e1d Class identity comparisons wherever possible
Issue: SPR-12926
2015-05-20 14:34:16 +02:00
Stephane Nicoll 073c176400 Fix test
The rework of 314b069 in a7fec6a has created a lazy proxy to make sure
that the need for an exception cache resolver come as late as possible.

Unfortunately, the test that was only failing on CI because of an early
lookup has not been updated accordingly. This is now the case.

Issue: SPR-12850
2015-03-28 12:23:30 +01:00
Stephane Nicoll a7fec6a459 Lazily resolve the default exception CacheResolver
This is a rework of 314b069 that may still lead to issue if a Cacheable
annotated bean is inspected on startup. Instead of resolving the default
exception CacheResolver if a cache operation is parsed, we resolve it as
late as possible (i.e. when an exception is thrown and the relevant
exception cache needs to be resolved)

Issue: SPR-12850
2015-03-27 09:42:06 +01:00
Stephane Nicoll 314b069fd8 Only require an exception CacheResolver if necessary
Previously, a cache infrastructure with only a CacheResolver would have
worked fine until the JSR-107 API is added to the classpath. When this is
the case, the JCache support kicks in and an exception cache resolver is
all of the sudden required.

The CacheResolver _is_ different as the default implementation does look
different attributes so if a custom CacheResolver is set, it is not
possible to "reuse" it as a fallback exception CacheResolver.

Now, an exception CacheResolver is only required if a JSR-107 annotation
with an "exceptionCacheName" attribute is processed (i.e. the exception
CacheResolver is lazily instantiated if necessary).

The use case of having a CachingConfigurerSupport with only a
CacheResolver was still broken though since the JCache support only looks
for a JCacheConfigurer bean (per the generic type set on
AbstractCachingConfiguration). This has been fixed as well.

Issue: SPR-12850
2015-03-25 15:12:08 +01:00
Juergen Hoeller d23893fd25 Consistent javadoc param declarations for type variables 2015-03-25 00:44:01 +01:00
Juergen Hoeller 26d4f91835 Compatibility with EhCache 3.0 M1 (as a JCache provider)
Issue: SPR-12847
2015-03-24 19:20:26 +01:00
Stephane Nicoll 9172a6d05e Restore proper use of CacheLoader
Since Guava 11, CacheLoader is only invoked with a LoadingCache but the
GuavaCache wrapper is always invoking getIfPresent(), available on the
main Guava Cache interface.

Update GuavaCache#get to check for the presence of a LoadingCache and
call the appropriate method.

Issue: SPR-12842
2015-03-22 10:02:36 +01:00
Stephane Nicoll a64532ede2 Add testConnection on JavaMailSender
Add a way to test that a particular JavaMailSender instance can connect
to the server that it is configured for.

Issue: SPR-12799
2015-03-10 16:58:29 +01:00
Stephane Nicoll babbf6e871 Harmonize resources location
Issue: SPR-12766
2015-02-28 10:32:40 +01:00
Stas Volsky ef95fc2f7e Synchronize clear on TransactionAwareCacheDecorator
Previously, a cache decorated with TransactionAwareCacheDecorator would
clear the cache immediately, even when a transaction is running. This
commit updates the decorator to synchronize to the afterCommit phase for
the clear operation as well.

Issue: SPR-12653
2015-02-10 14:53:16 +01:00
Stephane Nicoll c7b324b89b Move cached expression evaluation abstraction
Move MethodCacheKey and related classes to the expression package so that
other parts of the framework can benefit ot it.

CacheExpressionEvaluator is a base class that can be used to cache SpEL
expressions based on its annotation source (i.e. method). Sub-classing
that base class provides a simple to use API to retrieve Expression
instances efficiently.

Issue: SPR-12622
2015-01-26 14:44:14 +01:00
Juergen Hoeller 49e31c302b Allow schedulerWithHsqlDataSource to pass through reducing it to the trigger table check
Issue: SPR-12618
2015-01-21 11:11:07 +01:00
Sam Brannen d5fb829ade Polish failed assertion messages in QuartzSupportTests 2015-01-10 22:28:00 +01:00
Juergen Hoeller 223d849a14 Polishing 2014-11-23 00:12:02 +01:00
Juergen Hoeller 2675ce7c9f Polishing 2014-11-22 18:05:35 +01:00
Stephane Nicoll 330897b411 Fix typo 2014-11-03 13:35:14 +01:00
Juergen Hoeller e2518e0b7c Reduced DefaultJCacheOperationSource's dependency from ApplicationContext to BeanFactory
Issue: SPR-12336
2014-11-01 09:06:55 +01:00
Juergen Hoeller 0e36402bd2 Revised retrieval of cache strategy beans
Issue: SPR-12336
2014-11-01 08:26:48 +01:00