Commit Graph

951 Commits

Author SHA1 Message Date
Stephane Nicoll cd903e26de Polish 2016-01-22 04:35:33 +01:00
Andy Clement a12f23936c Allow use of '&' prefix to access factory bean in SpEL
Prior to this change SpEL did not have an syntactic
construct enabling easy access to a FactoryBean. With this
change it is now possible to use &foo in an expression when
the factory bean should be returned.

Issue: SPR-9511
2016-01-21 16:14:16 -08:00
Stephane Nicoll eb49f3c225 Add interface-based detection test
Add a test that explicitely validates that `@ManagedResource` and friends
can be set on an interface.

Issue: SPR-13138
2016-01-18 14:14:17 +01:00
Juergen Hoeller 182b1e99e3 TODO marker for test which fails as of AspectJ 1.9 beta 3
Issue: SPR-13839
2016-01-15 17:43:59 +01:00
Stephane Nicoll 2fc2c29e9a Update copyright header 2016-01-15 10:51:11 +01:00
Rossen Stoyanchev 3dae3fd8a9 Refine ListenableFutureCallback policy for exceptions
This change updates all cases where callbacks are invoked to catch and
suppress errors (since there is not match to do with and error from
a callback be it success or failure).

Also updated is the contract itself to clarify this and emphasize the
callbacks are really notifications for the outcome of the
ListenableFuture not the callbacks themselves.

Issue: SPR-13785
2016-01-14 17:49:01 -05:00
Juergen Hoeller 773d175681 Polishing 2016-01-13 12:52:05 +01:00
Juergen Hoeller e14c2de1d2 ImportStack extends ArrayDeque instead of Stack and relies on standard contains implementation
Issue: SPR-13852
2016-01-13 12:46:28 +01:00
Juergen Hoeller 27c2e8c80d Polishing 2015-12-29 21:40:20 +01:00
Juergen Hoeller 388bd87ef0 ComponentScan annotation is repeatable now
Issue: SPR-13151
2015-12-29 21:40:08 +01:00
Juergen Hoeller 4f955932a7 @Value can be used as aliased meta-annotation
Issue: SPR-13603
2015-12-29 18:02:16 +01:00
Juergen Hoeller 470ea977e1 Consistent validation of annotated methods behind AOP proxies
Issue: SPR-13816
2015-12-23 20:47:28 +01:00
Juergen Hoeller 1cfeb07fa5 Consistent use of varargs plus related polishing
(cherry picked from commit deae872)
2015-12-23 00:31:11 +01:00
Juergen Hoeller bb0bc3d415 Polishing 2015-12-22 16:19:26 +01:00
Stephane Nicoll 0194988425 Store by value support for ConcurrentMapCacheManager
ConcurrentMapCacheManager and ConcurrentMapCache now support the
serialization of cache entries via a new `storeByValue` attribute. If it is
explicitly enabled, the cache value is first serialized and that content
is stored in the cache.

The net result is that any further change made on the object returned
from the annotated method is not applied on the copy held in the cache.

Issue: SPR-13758
2015-12-22 13:50:23 +01:00
Stephane Nicoll d444ef4871 Support for bean refs in event SpEL condition
Issue: SPR-13814
2015-12-22 11:30:40 +01:00
Stephane Nicoll 9b5e47026c Support for bean refs in caching SpEL expressions
Issue: SPR-13182
2015-12-22 11:05:24 +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
Juergen Hoeller fca5365cf1 Avoid scoped destruction callbacks in case of no post-processor actually applying
Issue: SPR-13744
2015-12-18 16:54:05 +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 967ef73765 Detect @Autowired constructors for configuration classes
Issue: SPR-13471
2015-12-18 15:31:31 +01:00
Stephane Nicoll 9e7c791a0f Automatically autowire a bean with one constructor
Previously, if a managed bean had only one non-default constructor, we
should still annotate it with `@Autowired` to properly use constructor
injection. Not doing so resulted in an error as the container was
trying to call the default (non-existing) constructor.

This commit updates this behaviour to automatically applyed the
autowiring semantic to any bean that has only one constructor. As
before, if more than one constructor is defined, `@Autowired` must be
specified to teach the container the constructor it has to use.

Issue: SPR-12278
2015-12-18 14:04:18 +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
Sam Brannen 93de3553c1 Polish Javadoc in @Cache* annotations 2015-12-17 17:05:33 +01:00
Stephane Nicoll 752d3c715a Initiate structure for 4.3 XSDs 2015-12-17 15:43:23 +01:00
Juergen Hoeller 753347ea98 Consistent static final logger declarations 2015-12-16 20:44:00 +01:00
Juergen Hoeller fdc14a16ee AbstractApplicationContext clears ReflectionUtils cache as well
Issue: SPR-13783
2015-12-09 19:25:27 +01:00
Juergen Hoeller 76f84b914f Polishing 2015-12-09 13:10:04 +01:00
Juergen Hoeller 11806b9215 Class identity comparisons wherever possible (and further polishing)
Issue: SPR-12926
2015-12-09 12:28:09 +01:00
Stephane Nicoll 34b596c6bf Polish cache javadoc
Issue: SPR-13746
2015-12-09 11:24:53 +01:00
Juergen Hoeller 7a8a9c71b6 Javadoc fixes
Issue: SPR-13763
2015-12-07 12:51:44 +01:00
Juergen Hoeller def10343ea Unit tests for @Value Resource resolution
Issue: SPR-13731
2015-11-30 10:41:55 +01:00
Juergen Hoeller edbb8bbb01 JodaTimeFormatterRegistrar defensively checks whether Joda-Time 2.x is present (for Joda-Time 1.x tolerance on the classpath)
Also switches 4.2.4's new formatter implementations to package visibility, just in case they'll be superseded by another variant in the future.

Issue: SPR-13730
2015-11-29 22:22:05 +01:00
Juergen Hoeller dd647659b3 Rearranged cache test class names across several modules 2015-11-26 16:30:44 +01:00
Juergen Hoeller 8c4436926f Polishing 2015-11-26 02:09:37 +01:00
Juergen Hoeller 1da564d2f0 Joda/DateTimeFormatterRegistrar also supports YearMonth and MonthDay
Issue: SPR-13518
2015-11-25 23:39:14 +01:00
Juergen Hoeller bc0b707175 JodaTimeFormatterRegistrar supports Duration and Period as well
Issue: SPR-6706
2015-11-25 23:10:32 +01:00
Juergen Hoeller a0747c2148 Consistent bean type checking for endpoint handlers
Issue: SPR-13725
2015-11-25 21:26:03 +01:00
Stephane Nicoll c90ca15add Fix caching tests
Update assertion to validate the proper exception type is thrown.
2015-11-25 17:49:44 +01:00
Juergen Hoeller 24e4f56d7e Test case for event listener methods on bean with potentially inactive scope
Also taking the opportunity to refine the "No Scope registered" exception message a bit.

Issue: SPR-13681
2015-11-25 16:56:39 +01:00
Juergen Hoeller bb05bc7c01 EventListenerMethodProcessor leniently handles unresolvable bean types
Issue: SPR-13712
2015-11-25 15:40:38 +01:00
Juergen Hoeller 2a3bf69991 AsyncAnnotationBeanPostProcessor leniently handles ambiguous TaskExecutor beans
Issue: SPR-13720
2015-11-25 15:39:12 +01:00
Juergen Hoeller d5ca5b74a5 DateTimeFormatterRegistrar supports Duration and Period as well
Issue: SPR-13721
2015-11-25 00:21:03 +01:00
Juergen Hoeller 20a286b4d6 ASM ClassWriter uses application ClassLoader for its getCommonSuperClass check
Issue: SPR-13695
2015-11-24 17:38:02 +01:00
Juergen Hoeller 3aefc96593 @ManagedOperationParameter declares @Target/@Retention/@Documented/@Repeatable now
This also turns @ManagedNotification into a repeatable annotation and consistently applies findAnnotation/getRepeatableAnnotations.

Issue: SPR-13700
2015-11-24 17:37:51 +01:00
Andy Clement 29303ef591 Allow MapAccessor to be compilable in SpEL expressions
With this change the MapAccessor now extends CompilablePropertyAccessor
rather than just PropertyAccessor. This means that any expression that
ends up using the MapAccessor is now compilable for fast performance.

Issue: SPR-13638
2015-11-23 09:25:57 -08:00
Juergen Hoeller 6d5c646faf Empty lists declared with element type (for javac to accept it)
Issue: SPR-13680
2015-11-13 21:18:28 +01:00
Juergen Hoeller 3cb926e01c Task list getters never return null now
Issue: SPR-13680
2015-11-13 20:26:44 +01:00
Juergen Hoeller 55d20557e0 Task list getters explicitly check for null now
Issue: SPR-13680
2015-11-13 14:25:28 +01:00