Go to file
Sam Brannen 5e7021f3f7 Provide meta-annotation support in the TCF
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
2013-10-28 01:33:17 +01:00
.settings/gradle
buildSrc/src/main
gradle
spring-aop/src
spring-aspects
spring-beans/src Aligned with refinements in 3.2.x branch 2013-10-27 23:17:47 +01:00
spring-beans-groovy/src/main
spring-context Added further tests for raw matching of generic types 2013-10-27 11:02:16 +01:00
spring-context-support/src
spring-core/src Provide meta-annotation support in the TCF 2013-10-28 01:33:17 +01:00
spring-expression Make EvaluationException more informative 2013-10-25 17:55:02 -07:00
spring-instrument/src
spring-instrument-tomcat/src
spring-jdbc/src
spring-jms/src
spring-messaging/src
spring-orm/src Cache InjectionMetadata per bean name instead of per Class, if possible 2013-10-26 14:03:11 +02:00
spring-orm-hibernate4/src
spring-oxm
spring-test Provide meta-annotation support in the TCF 2013-10-28 01:33:17 +01:00
spring-test-mvc/src
spring-tx/src
spring-web/src Replace MvcUrls with MvcUriComponentsBuilder 2013-10-25 22:29:38 -04:00
spring-webmvc/src Replace use of jdk 1.8 api 2013-10-27 18:00:16 -04:00
spring-webmvc-portlet/src
spring-webmvc-tiles3/src
spring-websocket/src
src
.gitignore
CONTRIBUTING.md
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
import-into-eclipse.bat
import-into-eclipse.sh
import-into-idea.md
settings.gradle

README.md

Spring Framework

The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.

The framework also serves as the foundation for Spring Integration, Spring Batch and the rest of the Spring family of projects. Browse the repositories under the SpringSource organization on GitHub for a full list.

Downloading artifacts

See downloading Spring artifacts for Maven repository information. Unable to use Maven or other transitive dependency management tools? See building a distribution with dependencies.

Documentation

See the current Javadoc and reference docs.

Getting support

Check out the Spring forums and the spring and spring-mvc tags on Stack Overflow. Commercial support is available too.

Issue Tracking

Report issues via the Spring Framework JIRA. Understand our issue management process by reading about the lifecycle of an issue. Think you've found a bug? Please consider submitting a reproduction project via the spring-framework-issues GitHub repository. The readme there provides simple step-by-step instructions.

Building from source

The Spring Framework uses a Gradle-based build system. In the instructions below, ./gradlew is invoked from the root of the source tree and serves as a cross-platform, self-contained bootstrap mechanism for the build.

prerequisites

Git and OpenJDK 8 early access build 100 or later

Be sure that your JAVA_HOME environment variable points to the jdk1.8.0 folder extracted from the JDK download.

check out sources

git clone git://github.com/SpringSource/spring-framework.git

import sources into your IDE

Run ./import-into-eclipse.sh or read import-into-idea.md as appropriate.

Note: Per the prerequisites above, ensure that you have JDK 8 configured properly in your IDE.

install all spring-* jars into your local Maven cache

./gradlew install

compile and test, build all jars, distribution zips and docs

./gradlew build

... and discover more commands with ./gradlew tasks. See also the Gradle build and release FAQ.

Contributing

Pull requests are welcome; see the contributor guidelines for details.

Staying in touch

Follow @springframework and its team members on Twitter. In-depth articles can be found at the SpringSource team blog, and releases are announced via our news feed.

License

The Spring Framework is released under version 2.0 of the Apache License.