Commit Graph

10423 Commits

Author SHA1 Message Date
Stephane Nicoll
4ecb8611bc Merge pull request #811 from izeye/patch-2
* patch-2:
  Fix typo
2015-06-01 09:21:57 +02:00
izeye
b8d7d46da7 Fix typo 2015-06-01 09:21:38 +02:00
Sam Brannen
81844191f8 Polish Javadoc for @ImportResource 2015-05-31 23:06:15 +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
de06f422f3 Polish Javadoc for caching annotations 2015-05-31 22:51:53 +02:00
Sam Brannen
485790dc0e Introduce alias for 'value' attribute in @RenderMapping
Issue: SPR-11393
2015-05-31 21:24:32 +02:00
Sam Brannen
0d6b01b694 Introduce alias for 'value' attribute in @ActionMapping
Issue: SPR-11393
2015-05-31 21:08:26 +02:00
Sam Brannen
1a56b47502 Introduce alias for 'value' attribute in @MatrixVariable
Issue: SPR-11393
2015-05-31 18:50:35 +02:00
Sam Brannen
60eb9e9ca2 Introduce 'value' alias for 'origin' in @CrossOrigin
Issue: SPR-11393
2015-05-31 18:34:01 +02:00
Sam Brannen
f0c0813011 Change semantics of @CrossOrigin's maxAge regarding negative values 2015-05-31 18:20:52 +02:00
Sam Brannen
72b44af862 Introduce test for invalid @CrossOrigin.allowCredentials() 2015-05-31 18:17:52 +02:00
Sam Brannen
891d41c005 Fix typo in Javadoc 2015-05-31 18:13:57 +02:00
Sam Brannen
1b5947bf88 Polish Javadoc for @CrossOrigin 2015-05-31 17:44:45 +02:00
Sam Brannen
9ce7485237 Introduce alias for 'value' attribute in @SessionAttributes
Issue: SPR-11393
2015-05-31 17:21:03 +02:00
Sam Brannen
6a5b2672e7 Introduce alias for 'value' attribute in @ResponseStatus
Issue: SPR-11393
2015-05-31 17:00:23 +02:00
Sam Brannen
c55486d5d5 Introduce alias for 'value' attribute in @RequestPart
Issue: SPR-11393
2015-05-31 16:32:45 +02:00
Sam Brannen
034e0e2cf4 Introduce alias for 'value' attribute in @RequestParam
Issue: SPR-11393
2015-05-31 16:20:38 +02:00
Sam Brannen
25a5d9d759 Introduce alias for 'value' attribute in @RequestHeader
Issue: SPR-11393
2015-05-31 16:20:33 +02:00
Sam Brannen
c4c3ce796a Introduce alias for 'value' attribute in @CookieValue
Issue: SPR-11393
2015-05-31 16:07:27 +02:00
Sam Brannen
845f4f2bb7 Improve attribute alias support in @ComponentScan
Prior to this commit, @ComponentScan already had a value/basePackages
alias pair; however, the semantics were not properly enforced.

This commit addresses this issue by refactoring
ComponentScanAnnotationParser to ensure that it is not possible to
declare both of the aliased attributes. In addition, the 'value' and
'basePackages' attributes are now annotated with @AliasFor in order to
make the semantics clearer.

Issue: SPR-11393
2015-05-31 15:39:15 +02:00
Sam Brannen
94aa90646b Polish Javadoc for @ComponentScan 2015-05-31 15:32:56 +02:00
Sam Brannen
7b10dc6e93 Fix typo in Javadoc 2015-05-29 23:24:09 +02:00
Sam Brannen
60a5ec87d0 Introduce alias for 'value' attribute in @Header
This commit introduces 'name' as an alias for 'value' in @Header.

Issue: SPR-11393
2015-05-29 23:23:52 +02:00
Sam Brannen
35c3e7c0f3 Polishing 2015-05-29 23:10:25 +02:00
Sam Brannen
250787a35a Introduce alias for 'value' attribute in @Payload
This commit introduces 'expression' as an alias for 'value' in @Payload.

Issue: SPR-11393
2015-05-29 22:58:55 +02:00
Sam Brannen
518c85b107 Support synthesized annotations in MethodParameter 2015-05-29 22:48:55 +02:00
Sam Brannen
1afc938da1 Introduce synthesizeAnnotationArray() in AnnotationUtils 2015-05-29 22:45:34 +02:00
Sam Brannen
9f717871e6 Introduce getAnnotation() in AnnotatedElementUtils
This commit introduces a "synthesized annotation" alternative to
getAnnotationAttributes() in AnnotatedElementUtils, analogous to the
recently introduced findAnnotation() methods.

Issue: SPR-13082
2015-05-29 22:04:10 +02:00
Sam Brannen
9afcd17c71 Introduce getAnnotationAttributes(..,Class) in AnnoElUtils 2015-05-29 21:36:00 +02:00
Sam Brannen
46be176875 Allow AnnoConfigEx to propagate from getRepeatableAnnotation()
Issue: SPR-13084
2015-05-29 21:17:33 +02:00
Sam Brannen
8f233786ed Polishing 2015-05-29 02:05:44 +02:00
Sam Brannen
7018747cec Remove trailing whitespace in Java source code 2015-05-29 02:03:44 +02:00
Sam Brannen
a31d1bdf60 Merge from sbrannen/SPR-13067
* SPR-13067:
  Synthesize annotation from a map of attributes
2015-05-29 01:43:50 +02:00
Sam Brannen
e30c9b2ef3 Synthesize annotation from a map of attributes
Spring Framework 4.2 RC1 introduced support for synthesizing an
annotation from an existing annotation in order to provide additional
functionality above and beyond that provided by Java. Specifically,
such synthesized annotations provide support for @AliasFor semantics.
As luck would have it, the same principle can be used to synthesize an
annotation from any map of attributes, and in particular, from an
instance of AnnotationAttributes.

The following highlight the major changes in this commit toward
achieving this goal.

- Introduced AnnotationAttributeExtractor abstraction and refactored
  SynthesizedAnnotationInvocationHandler to delegate to an
  AnnotationAttributeExtractor.

- Extracted code from SynthesizedAnnotationInvocationHandler into new
  AbstractAliasAwareAnnotationAttributeExtractor and
  DefaultAnnotationAttributeExtractor implementation classes.

- Introduced MapAnnotationAttributeExtractor for synthesizing an
  annotation that is backed by a map or AnnotationAttributes instance.

- Introduced a variant of synthesizeAnnotation() in AnnotationUtils
  that accepts a map.

- Introduced findAnnotation(*) methods in AnnotatedElementUtils that
  synthesize merged AnnotationAttributes back into an annotation of the
  target type.

The following classes have been refactored to use the new support for
synthesizing AnnotationAttributes back into an annotation.

- ApplicationListenerMethodAdapter
- TestAnnotationUtils
- AbstractTestContextBootstrapper
- ActiveProfilesUtils
- ContextLoaderUtils
- DefaultActiveProfilesResolver
- DirtiesContextTestExecutionListener
- TestPropertySourceAttributes
- TestPropertySourceUtils
- TransactionalTestExecutionListener
- MetaAnnotationUtils
- MvcUriComponentsBuilder
- RequestMappingHandlerMapping

In addition, this commit also includes changes to ensure that arrays
returned by synthesized annotations are properly cloned first.

Issue: SPR-13067
2015-05-29 01:38:51 +02:00
Sam Brannen
f41de12cf6 Ensure synthesized nested annotation arrays retain correct type
Prior to this commit, when a nested array of annotations was
synthesized while adapting values within an AnnotationAttributes map,
the array was improperly replaced with an array of type Annotation[]
instead of an array of the concrete annotation type, which can lead to
unexpected run-time exceptions.

This commit fixes this bug by replacing annotations in the existing
array with synthesized versions of those annotations, thereby retaining
the original array's component type.

Issue: SPR-13077
2015-05-27 17:55:10 +02:00
Sam Brannen
a2f152ce8b Support nested annotations in AnnotationAttributes
This commit introduces support in AnnotationAttributes for retrieving
nested annotations that is on par with the existing type-safe support
for retrieving nested AnnotationAttributes.

Issue: SPR-13074
2015-05-27 17:03:01 +02:00
Sam Brannen
0ac0e2ce20 Document public API in AnnotationAttributes
AnnotationAttributes has existed for several years, but none of the
"get" methods that make up its public API are documented. In many
cases, the behavior can be inferred from the name of the method, but
for some methods there are "hidden gems" and unexpected behavior
lurking behind the scenes.

This commit addresses this issue by documenting all public methods. In
addition, the hidden support for converting single elements into
single-element arrays has also been documented and tested.

Issue: SPR-13072
2015-05-27 16:15:25 +02:00
Sam Brannen
197f6594f4 Simplify annotation attribute override algorithm
Issue: SPR-11513
2015-05-24 17:59:30 +02:00
Sam Brannen
c80932490f Complete documentation of synthesized annotations
Issue: SPR-11512
2015-05-24 16:42:09 +02:00
Sam Brannen
b6f2d95c3e Cache computed values in SynthesizedAnnotationInvocationHandler
Issue: SPR-11512
2015-05-24 15:58:20 +02:00
Sam Brannen
8ecae8697a Cache attribute methods in AnnotationUtils
Issue: SPR-11512
2015-05-24 15:58:20 +02:00
Sam Brannen
d5974a18ab Polish AnnotationUtils 2015-05-24 15:58:19 +02:00
Sam Brannen
a1fc2097a1 Document SynthesizedAnnotationInvocationHandler constructor
Issue: SPR-11512
2015-05-24 15:58:07 +02:00
Sam Brannen
c13f689537 Document isSynthesizable() in AnnotationUtils
Issue: SPR-11512
2015-05-24 00:13:53 +02:00
Sam Brannen
7f22f09890 PolishingPolish SynthesizedAnnotationInvocationHandler 2015-05-23 23:58:35 +02:00
Sam Brannen
def7663ec4 Implement hashCode() for synthesized annotations
Issue: SPR-13066
2015-05-23 23:46:48 +02:00
Sam Brannen
ae5c8285a6 Polish SynthesizedAnnotationInvocationHandler 2015-05-23 22:40:05 +02:00
Sam Brannen
7e2e9a80d0 Document getAttributeMethods() in AnnotationUtils
Issue: SPR-11512
2015-05-23 22:29:12 +02:00
Sam Brannen
7bf609f111 Implement equals() for synthesized annotations
Issue: SPR-13065
2015-05-23 22:29:12 +02:00
Juergen Hoeller
c622f4c487 Polishing 2015-05-23 22:24:10 +02:00