- 13 5月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
This commit improves the documentation for AnnotationUtils and AnnotatedElementUtils by explaining that the scope of most annotation searches is limited to finding the first such annotation, resulting in additional such annotations being silently ignored. Issue: SPR-13015
-
- 06 5月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
This commit picks up where SPR-11483 left off, with the goal of eliminating all unnecessary inspection of core JDK annotations in Spring's annotation search algorithms in AnnotatedElementUtils and AnnotationMetadataReadingVisitor. Issue: SPR-12989
-
- 24 4月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
This commit introduces support for finding annotations on abstract, bridge, and interface methods in AnnotatedElementUtils. - Introduced dedicated findAnnotationAttributes() methods in AnnotatedElementUtils that provide first-class support for processing methods, class hierarchies, interfaces, bridge methods, etc. - Introduced find/get search algorithm dichotomy in AnnotatedElementUtils which is visible in the public API as well as in the internal implementation. This was necessary in order to maintain backwards compatibility with the existing API (even though it was undocumented). - Reverted all recent changes made to the "get semantics" search algorithm in AnnotatedElementUtils in order to ensure backwards compatibility, and reverted recent changes to JtaTransactionAnnotationParser and SpringTransactionAnnotationParser accordingly. - Documented internal AnnotatedElementUtils.Processor<T> interface. - Enabled failing tests and introduced findAnnotationAttributesFromBridgeMethod() test in AnnotatedElementUtilsTests. - Refactored ApplicationListenerMethodAdapter.getCondition() and enabled failing test in TransactionalEventListenerTests. - AnnotationUtils.isInterfaceWithAnnotatedMethods() is now package private. Issue: SPR-12738, SPR-11514, SPR-11598
-
- 23 4月, 2015 2 次提交
-
-
由 Sam Brannen 提交于
-
由 Sam Brannen 提交于
-
- 22 4月, 2015 2 次提交
-
-
由 Sam Brannen 提交于
Prior to this commit, the search algorithm used by the findAnnotation(Method, Class) method in AnnotationUtils only found direct annotations or direct meta-annotations (i.e., one level of meta-annotations). This commit reworks the search algorithm so that it supports arbitrary levels of meta-annotations on methods. To make this possible, a new findAnnotation(AnnotatedElement, Class) method has been introduced in AnnotationUtils. This fix also allows for the @Ignore'd tests in TransactionalEventListenerTests to be re-enabled. Issue: SPR-12941
-
由 Sam Brannen 提交于
Issue: SPR-12940
-
- 04 4月, 2015 1 次提交
-
-
由 Juergen Hoeller 提交于
Also refines logIntrospectionFailure to just log at debug level for meta-annotation introspection failures. Issue: SPR-12889
-
- 31 3月, 2015 1 次提交
-
-
由 Juergen Hoeller 提交于
AnnotationUtils.getAnnotationAttributes makes Method accessible (analogous to AnnotationUtils.getValue) Issue: SPR-12858
-
- 20 1月, 2015 1 次提交
-
-
由 Juergen Hoeller 提交于
Issue: SPR-12604
-
- 08 1月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
This commit updates the Javadoc for findAnnotation() to reflect recent changes to the algorithm it implements.
-
- 02 12月, 2014 1 次提交
-
-
由 Juergen Hoeller 提交于
Issue: SPR-12493
-
- 29 10月, 2014 1 次提交
-
-
由 Juergen Hoeller 提交于
Normalized AnnotationAttributesReadingVisitor class layout and improved diagnostics through delegating to AnnotationUtils Issue: SPR-12387
-
- 21 10月, 2014 2 次提交
-
-
由 Juergen Hoeller 提交于
Issue: SPR-12325
-
由 Juergen Hoeller 提交于
AnnotationUtils favors local composed annotations over interface annotations and consistently logs introspection failures via lazily initialized logger Issue: SPR-12355 Issue: SPR-12325 Issue: SPR-12329
-
- 08 8月, 2014 1 次提交
-
-
由 Juergen Hoeller 提交于
Issue: SPR-12065
-
- 02 8月, 2014 1 次提交
-
-
由 Sam Brannen 提交于
-
- 01 7月, 2014 1 次提交
-
-
由 Juergen Hoeller 提交于
-
- 27 6月, 2014 1 次提交
-
-
由 Juergen Hoeller 提交于
ReflectionUtils caches Class.getDeclaredMethods() results; AnnotationUtils caches findAnnotation results Issue: SPR-11882
-
- 24 6月, 2014 2 次提交
-
-
由 Juergen Hoeller 提交于
AnnotationUtils defensively catches and logs unexpected exceptions from retrieval attempts (proceeding like the annotation wasn't there) Issue: SPR-11874
-
由 Juergen Hoeller 提交于
AnnotationUtils defensively catches unexpected exceptions from retrieval attempts (proceeding like the annotation wasn't there) This is analogous to what the JVM does for cases where the annotation type itself isn't present on the classpath. We're effectively extending that policy to values referenced within an annotation declaration. Issue: SPR-11874
-
- 30 4月, 2014 2 次提交
-
-
由 Juergen Hoeller 提交于
-
由 Juergen Hoeller 提交于
-
- 29 4月, 2014 1 次提交
-
-
由 Juergen Hoeller 提交于
-
- 23 4月, 2014 1 次提交
-
-
由 Juergen Hoeller 提交于
-
- 20 3月, 2014 1 次提交
-
-
由 Sam Brannen 提交于
Prior to this commit, Spring supported meta-annotation attribute overrides in custom composed annotations with reflection-based annotation processing but not with ASM-based annotation processing. This commit ensures that meta-annotation attribute overrides are supported in AnnotationMetadataReadingVisitor.getAnnotationAttributes(). Issue: SPR-11574
-
- 27 2月, 2014 1 次提交
-
-
由 Sam Brannen 提交于
The previous commit introduced a dependency on Class.getDeclaredAnnotation() which is a Java 8 API. This commit refactors AnnotationUtils.findAnnotation(Class, Class, Set) to use Class.getAnnotation() in conjunction with isAnnotationDeclaredLocally() in order to achieve the same desired behavior. Issue: SPR-11475
-
- 26 2月, 2014 2 次提交
-
-
由 Sam Brannen 提交于
Prior to this commit, the implementations of findAnnotation() in AnnotationUtils and getAnnotationAttributes() in AnnotatedElementUtils favored inherited annotations and inherited composed annotations over composed annotations that are declared closer to the starting class passed to these methods. This commit addresses this issue as follows: - Refactored AnnotationUtils to use getDeclaredAnnotation() and getDeclaredAnnotations() instead of getAnnotation() and getAnnotations() where appropriate. - AnnotatedElementUtils.doProcess() supports a traverseClassHierarchy flag to control whether the class hierarchy should be traversed, using getDeclaredAnnotations() instead of getAnnotations() if the flag is true. - Overhauled Javadoc in AnnotatedElementUtils. Issue: SPR-11475
-
由 Sam Brannen 提交于
This commit introduces a new isInJavaLangAnnotationPackage(Annotation) method in AnnotationUtils. This method is now used in AnnotationUtils, AnnotatedElementUtils, and MetaAnnotationUtils to ensure that search algorithms do no search for meta-annotations on annotations in the "java.lang.annotation" package. The following are some empirical results from this change: - The number of times that the findAnnotation(Class,Class,Set) method in AnnotationUtils is recursively invoked while executing AnnotationUtilsTests drops from 51 to 29. - The number of times that the process(AnnotatedElement) method in AnnotationUtils.AnnotationCollector is recursively invoked while executing AnnotationUtilsTests.getRepeatableFromMethod() drops from 16 to 2. - The number of times that the doProcess() method in AnnotatedElementUtils is recursively invoked while executing the "getAnnotationAttributes() On MetaCycleAnnotatedClass with missing target meta-annotation" test in AnnotatedElementUtilsTests drops from 23 to 5. - The number of times that the findAnnotationDescriptor(Class,Set,Class) method in MetaAnnotationUtils is recursively invoked while executing the "findAnnotationDescriptor() on MetaCycleAnnotatedClass with missing target meta-annotation" test in MetaAnnotationUtilsTests drops from 16 to 8. Issue: SPR-11483
-
- 22 2月, 2014 1 次提交
-
-
由 Sam Brannen 提交于
-
- 20 2月, 2014 1 次提交
-
-
由 Sam Brannen 提交于
Prior to this commit, AnnotationUtils.findAnnotation(Class, Class) claimed to recursively search through annotations; however, only one level of annotations was supported by the algorithm. This commit alters the search algorithm so that nested meta-annotations (i.e., meta-annotations on meta-annotations) are also supported. Issue: SPR-11448
-
- 26 11月, 2013 1 次提交
-
-
由 Phillip Webb 提交于
Fix remaining Java compiler warnings, mainly around missing generics or deprecated code. Also add the `-Werror` compiler option to ensure that any future warnings will fail the build. Issue: SPR-11064
-
- 22 11月, 2013 1 次提交
-
-
由 Sam Brannen 提交于
- Added explicit reference to “get” and “find” lookup types in the class-level Javadoc. - Updated documentation for the underlying algorithms in findAnnotation(Method,Class) and findAnnotation(Class,Class) in line with the status quo. - Reverted recent changes to findAnnotationDeclaringClass() by removing meta-annotation support in order to maintain backwards compatibility with previous releases.
-
- 21 11月, 2013 1 次提交
-
-
由 Sam Brannen 提交于
Prior to this commit, the getValue(Annotation, String) method in AnnotationUtils failed to retrieve the value of the desired annotation attribute if the annotation itself was not public -- for example if the annotation was declared as package private. This commit addresses this issue by ensuring that getValue(Annotation, String) uses reflection to make the desired annotation attribute method accessible before attempting to invoke it to retrieve the value. Issue: SPR-11104
-
- 28 10月, 2013 1 次提交
-
-
由 Sam Brannen 提交于
Spring 3.0 already allows component stereotypes to be used in a meta-annotation fashion, for example by creating a custom @TransactionalService stereotype annotation which combines @Transactional and @Service in a single, reusable, application-specific annotation. However, the Spring TestContext Framework (TCF) currently does not provide any support for test-related annotations to be used as meta-annotations. This commit overhauls the TCF with regard to how annotations are retrieved and adds explicit support for the following annotations to be used as meta-annotations in conjunction with the TCF. - @ContextConfiguration - @ContextHierarchy - @ActiveProfiles - @DirtiesContext - @IfProfileValue - @ProfileValueSourceConfiguration - @BeforeTransaction - @AfterTransaction - @TransactionConfiguration - @Rollback - @TestExecutionListeners - @Repeat - @Timed - @WebAppConfiguration Note that meta-annotation support for @Transactional was already available prior to this commit. The following is a summary of the major changes included in this commit. - Now using AnnotationUtils.getAnnotation() instead of Class.getAnnotation() where appropriate in the TestContext Framework. - Now using AnnotationUtils.findAnnotation() instead of Class.isAnnotationPresent() where appropriate in the TestContext Framework. - Introduced findAnnotationPrefersInteracesOverLocalMetaAnnotations() in AnnotationUtilsTests in order to verify the status quo. - AnnotationUtils.findAnnotationDeclaringClass() and AnnotationUtils.findAnnotationDeclaringClassForTypes() now support meta annotations. - Introduced MetaAnnotationUtils and AnnotationDescriptor in the spring-test module. - Introduced UntypedAnnotationDescriptor in MetaAnnotationUtils. - Introduced findAnnotationDescriptorForTypes() in MetaAnnotationUtils. - ContextLoaderUtils now uses MetaAnnotationUtils for looking up @ActiveProfiles as a potential meta-annotation. - TestContextManager now uses MetaAnnotationUtils for looking up @TestExecutionListeners as a potential meta-annotation. - DirtiesContextTestExecutionListener now uses AnnotationUtils for looking up @DirtiesContext as a potential meta-annotation. - Introduced DirtiesContextTestExecutionListenerTests. - ProfileValueUtils now uses AnnotationUtils for looking up @IfProfileValue and @ProfileValueSourceConfiguration as potential meta-annotations. - @BeforeTransaction and @AfterTransaction now support ANNOTATION_TYPE as a target, allowing them to be used as meta-annotations. - TransactionalTestExecutionListener now uses AnnotationUtils for looking up @BeforeTransaction, @AfterTransaction, @Rollback, and @TransactionConfiguration as potential meta-annotations. - Introduced TransactionalTestExecutionListenerTests. - @Repeat and @Timed now support ANNOTATION_TYPE as a target, allowing them to be used as meta-annotations. - SpringJUnit4ClassRunner now uses AnnotationUtils for looking up @Repeat and @Timed as potential meta-annotations. - Moved all remaining logic for building the MergedContextConfiguration from the DefaultTestContext constructor to ContextLoaderUtils.buildMergedContextConfiguration(). - Verified meta-annotation support for @WebAppConfiguration and @ContextConfiguration. Issue: SPR-7827
-
- 23 10月, 2013 1 次提交
-
-
由 Phillip Webb 提交于
Support repeatable @PropertySource annotations in Java 8 and add @PropertySources container annotation for Java 6/7. Also add an ignoreResourceNotFound attribute to @PropertySource allowing missing property resources to be silently ignored. This commit also introduces some generally useful methods to AnnotationUtils for working with @Repeatable annotations. Issue: SPR-8371
-
- 28 8月, 2013 1 次提交
-
-
由 Juergen Hoeller 提交于
This turned into a rather huge affair since it led to the introduction of a new AutowireCandidateResolver implementation in the spring-context module. That ACR impl is now being set through AnnotationConfigUtils; GenericApplicationContext and co do not set a default QualifierAnnotationAutowireCandidateResolver anymore (which has always been a smell anyway). At the same time, dependency ordering has moved from AutowiredAnnotationBeanPostProcessor to DefaultListableBeanFactory itself through a "dependencyComparator" strategy, applying to constructor dependencies and lazy resolution proxies as well. Issue: SPR-10353
-
- 21 8月, 2013 1 次提交
-
-
由 Juergen Hoeller 提交于
Issue: SPR-10181
-
- 17 5月, 2013 1 次提交
-
-
由 Juergen Hoeller 提交于
Issue: SPR-10514
-
- 07 3月, 2013 1 次提交
-
-
由 Sam Brannen 提交于
Prior to this commit the Spring TestContext Framework supported creating only flat, non-hierarchical contexts. There was no easy way to create contexts with parent-child relationships. This commit addresses this issue by introducing a new @ContextHierarchy annotation that can be used in conjunction with @ContextConfiguration for declaring hierarchies of application contexts, either within a single test class or within a test class hierarchy. In addition, @DirtiesContext now supports a new 'hierarchyMode' attribute for controlling context cache clearing for context hierarchies. - Introduced a new @ContextHierarchy annotation. - Introduced 'name' attribute in @ContextConfiguration. - Introduced 'name' property in ContextConfigurationAttributes. - TestContext is now aware of @ContextHierarchy in addition to @ContextConfiguration. - Introduced findAnnotationDeclaringClassForTypes() in AnnotationUtils. - Introduced resolveContextHierarchyAttributes() in ContextLoaderUtils. - Introduced buildContextHierarchyMap() in ContextLoaderUtils. - @ContextConfiguration and @ContextHierarchy may not be used as top-level, class-level annotations simultaneously. - Introduced reference to the parent configuration in MergedContextConfiguration and WebMergedContextConfiguration. - Introduced overloaded buildMergedContextConfiguration() methods in ContextLoaderUtils in order to handle context hierarchies separately from conventional, non-hierarchical contexts. - Introduced hashCode() and equals() in ContextConfigurationAttributes. - ContextLoaderUtils ensures uniqueness of @ContextConfiguration elements within a single @ContextHierarchy declaration. - Introduced CacheAwareContextLoaderDelegate that can be used for loading contexts with transparent support for interacting with the context cache -- for example, for retrieving the parent application context in a context hierarchy. - TestContext now delegates to CacheAwareContextLoaderDelegate for loading contexts. - Introduced getParentApplicationContext() in MergedContextConfiguration - The loadContext(MergedContextConfiguration) methods in AbstractGenericContextLoader and AbstractGenericWebContextLoader now set the parent context as appropriate. - Introduced 'hierarchyMode' attribute in @DirtiesContext with a corresponding HierarchyMode enum that defines EXHAUSTIVE and CURRENT_LEVEL cache removal modes. - ContextCache now internally tracks the relationships between contexts that make up a context hierarchy. Furthermore, when a context is removed, if it is part of a context hierarchy all corresponding contexts will be removed from the cache according to the supplied HierarchyMode. - AbstractGenericWebContextLoader will set a loaded context as the ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE in the MockServletContext when context hierarchies are used if the context has no parent or if the context has a parent that is not a WAC. - Where appropriate, updated Javadoc to refer to the ServletTestExecutionListener, which was introduced in 3.2.0. - Updated Javadoc to avoid and/or suppress warnings in spring-test. - Suppressed remaining warnings in code in spring-test. Issue: SPR-5613, SPR-9863
-