Go to file
Sam Brannen c23edf7da6 Introduce fluent API for searches in MergedAnnotations
Prior to this commit, searching for merged annotations on an
AnnotatedElement in the MergedAnnotations model was only supported via
various overloaded from(...) factory methods. In addition, it was not
possible to provide a custom AnnotationFilter without providing an
instance of RepeatableContainers.

This commit introduces a fluent API for searches in MergedAnnotations
to address these issues and improve the programming model for users of
MergedAnnotations.

To begin a search, invoke MergedAnnotations.search(SearchStrategy) with
the desired search strategy. Optional configuration can then be
provided via one of the with(...) methods. To perform a search, invoke
from(AnnotatedElement), supplying the element from which to begin the
search -- for example, a Class or a Method.

For example, the following performs a search on MyClass within the
entire type hierarchy of that class while ignoring repeatable
annotations.

MergedAnnotations mergedAnnotations =
    MergedAnnotations.search(SearchStrategy.TYPE_HIERARCHY)
        .withRepeatableContainers(RepeatableContainers.none())
        .from(MyClass.class);

To reuse search configuration to perform the same type of search on
multiple elements, you can save the Search instance as demonstrated in
the following example.

Search search = MergedAnnotations.search(SearchStrategy.TYPE_HIERARCHY)
                    .withRepeatableContainers(RepeatableContainers.none());

MergedAnnotations mergedAnnotations = search.from(MyClass.class);
// do something with the MergedAnnotations for MyClass
mergedAnnotations = search.from(AnotherClass.class);
// do something with the MergedAnnotations for AnotherClass

In addition, this fluent search API paves the way for introducing
support for a predicate that controls the search on enclosing classes
(gh-28207) and subsequently for completely removing the
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES search strategy (gh-28080).

Closes gh-28208
2022-03-22 20:01:24 +01:00
.github Update link for reporting security issues 2021-01-26 21:39:29 +00:00
buildSrc Configure Spring Milestone repository for apiDiff task 2022-01-13 12:24:39 +01:00
ci Merge branch '5.3.x' 2022-03-10 10:10:57 +01:00
framework-bom Add module to support testing of generated code 2022-03-09 11:17:21 +01:00
gradle Upgrade to Gradle 7.4.1 2022-03-20 11:24:02 +01:00
integration-tests Fix broken test missed in merge 2022-02-03 15:16:27 +01:00
spring-aop Merge branch '5.3.x' 2022-03-18 16:47:12 +01:00
spring-aspects Remove references to JCacheConfigurerSupport and CachingConfigurerSupport 2021-12-29 10:53:56 +01:00
spring-beans Add Javadoc since for BeanDefinitionValueResolver.resolveInnerBean() 2022-03-22 16:52:51 +01:00
spring-context Merge branch '5.3.x' 2022-03-21 17:13:30 +01:00
spring-context-indexer Partially revert e1200f34e7 2022-01-04 16:20:55 +01:00
spring-context-support Polish contribution 2022-02-19 14:43:26 +01:00
spring-core Introduce fluent API for searches in MergedAnnotations 2022-03-22 20:01:24 +01:00
spring-core-test Polish "Add module to support testing of generated code" 2022-03-09 11:17:21 +01:00
spring-expression Merge branch '5.3.x' 2022-03-09 11:08:36 +01:00
spring-instrument Delete obsolete log4j config 2020-03-18 17:01:01 +01:00
spring-jcl Polish contribution 2022-02-19 14:43:26 +01:00
spring-jdbc Merge branch '5.3.x' 2022-03-16 11:24:24 +01:00
spring-jms Polish contribution 2022-02-19 14:43:26 +01:00
spring-messaging Merge branch '5.3.x' 2022-03-11 16:22:18 +01:00
spring-orm Polish contribution 2022-02-19 14:43:26 +01:00
spring-oxm Merge branch '5.3.x' 2022-03-18 16:47:12 +01:00
spring-r2dbc Remove obsolete code in R2dbcTransactionManager 2022-03-21 16:21:08 +01:00
spring-test Merge branch '5.3.x' 2022-03-16 15:07:53 +01:00
spring-tx Merge branch '5.3.x' 2022-03-18 16:47:12 +01:00
spring-web Explicitly close ApplicationContexts and clean up warnings in tests 2022-03-20 12:34:56 +01:00
spring-webflux Merge branch '5.3.x' 2022-03-16 15:07:53 +01:00
spring-webmvc Merge branch '5.3.x' 2022-03-16 15:07:53 +01:00
spring-websocket Merge branch '5.3.x' 2022-03-16 15:07:53 +01:00
src Merge branch '5.3.x' 2022-03-18 16:47:12 +01:00
.editorconfig Add EditorConfig 2017-06-12 08:07:54 +02:00
.gitattributes Ensure line endings for binary files are not modified in Git 2019-10-18 11:56:18 +02:00
.gitignore Add vscode folder to .gitignore 2021-02-23 17:43:39 +01:00
.mailmap Change gopivotal.com to pivotal.io 2014-10-05 18:12:50 +02:00
.sdkmanrc Use JDK 17 on main branch in .sdkmanrc 2022-02-17 11:55:25 +01:00
CODE_OF_CONDUCT.adoc URL Cleanup 2019-03-21 15:08:55 -05:00
CONTRIBUTING.md Polishinig 2021-10-08 14:00:23 +02:00
LICENSE.txt Add LICENSE.txt file 2019-08-20 22:01:12 +02:00
README.md Add section of CI builds 2021-03-03 11:42:35 +01:00
SECURITY.md Update "Reporting a Vulnerability" link 2021-10-20 14:48:51 +02:00
build.gradle Upgrade to Tomcat 10.0.18 2022-03-17 15:01:26 +01:00
gradle.properties Next development version (v5.3.18-SNAPSHOT) 2022-03-17 10:51:02 +00:00
gradlew Upgrade to Gradle 7.2 2021-09-13 09:37:35 +02:00
gradlew.bat Upgrade to Gradle 6.6 2020-08-11 12:10:35 +02:00
import-into-eclipse.md Remove Groovy from "Eclipse/STS Project Import Guide" 2022-01-21 11:27:09 +01:00
import-into-idea.md URL Cleanup 2019-03-21 15:08:55 -05:00
settings.gradle Add module to support testing of generated code 2022-03-09 11:17:21 +01:00

README.md

Spring Framework Build Status Revved up by Gradle Enterprise

This is the home of the Spring Framework: the foundation for all Spring projects. Collectively the Spring Framework and the family of Spring projects are often referred to simply as "Spring".

Spring provides everything required beyond the Java programming language for creating enterprise applications for a wide range of scenarios and architectures. Please read the Overview section as reference for a more complete introduction.

Code of Conduct

This project is governed by the Spring Code of Conduct. By participating, you are expected to uphold this code of conduct. Please report unacceptable behavior to spring-code-of-conduct@pivotal.io.

Access to Binaries

For access to artifacts or a distribution zip, see the Spring Framework Artifacts wiki page.

Documentation

The Spring Framework maintains reference documentation (published and source), Github wiki pages, and an API reference. There are also guides and tutorials across Spring projects.

Micro-Benchmarks

See the Micro-Benchmarks Wiki page.

Build from Source

See the Build from Source Wiki page and the CONTRIBUTING.md file.

Continuous Integration Builds

Information regarding CI builds can be found in the Spring Framework Concourse pipeline documentation.

Stay in Touch

Follow @SpringCentral, @SpringFramework, and its team members on Twitter. In-depth articles can be found at The Spring Blog, and releases are announced via our news feed.

License

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