Sam Brannen 274a689a10 Revise RepeatableContainers API to better guide developers
Historically, the Spring Framework first had support for repeatable
annotations based on convention and later added explicit support for
Java 8's @⁠Repeatable facility. Consequently, the support for both
types of repeatable annotations has grown a bit intertwined over the
years. However, modern Java applications typically make use of
@⁠Repeatable, and convention-based repeatable annotations have become
more of a niche.

The RepeatableContainers API supports both types of repeatable
annotations with @⁠Repeatable support being the default. However,
RepeatableContainers.of() makes it very easy to enable support for
convention-based repeatable annotations while accidentally disabling
support for @⁠Repeatable, which can lead to subtle bugs – for example,
if convention-based annotations are combined with @⁠Repeatable
annotations. In addition, it is not readily clear how to combine
@⁠Repeatable support with convention-based repeatable annotations.

In light of the above, this commit revises the RepeatableContainers API
to better guide developers to use @⁠Repeatable support for almost all
use cases while still supporting convention-based repeatable
annotations for special use cases.

Specifically:

- RepeatableContainers.of() is now deprecated in favor of the new
  RepeatableContainers.explicitRepeatable() method.

- RepeatableContainers.and() is now deprecated in favor of the new
  RepeatableContainers.plus() method which declares the repeatable and
  container arguments in the same order as the rest of Spring
  Framework's repeated annotation APIs.

For example, instead of the following confusing mixture of
repeatable/container and container/repeatable:

RepeatableContainers.of(A.class, A.Container.class)
    .and(B.Container.class, B.class)

Developers are now be able to use:

RepeatableContainers.explicitRepeatable(A.class, A.Container.class)
    .plus(B.class, B.Container.class)

This commit also overhauls the Javadoc for RepeatableContainers and
explicitly points out that the following is the recommended approach to
support convention-based repeatable annotations while retaining support
for @⁠Repeatable.

RepeatableContainers.standardRepeatables()
    .plus(MyRepeatable1.class, MyContainer1.class)
    .plus(MyRepeatable2.class, MyContainer2.class)

See gh-20279
Closes gh-34637
2025-03-23 18:38:45 +01:00
2025-02-04 09:30:02 +01:00
2025-03-10 11:04:14 +01:00
2024-12-21 16:02:15 +01:00
2025-03-17 18:13:04 +01:00
2025-03-16 16:15:24 +01:00
2025-03-20 10:24:39 +01:00
2025-03-21 15:54:43 +01:00
2025-03-19 16:24:18 +01:00
2025-03-19 16:24:18 +01:00
2025-03-21 10:58:40 +01:00
2025-03-21 15:54:43 +01:00
2025-03-19 16:24:18 +01:00
2025-03-19 16:24:18 +01:00
2025-03-19 11:00:39 +01:00
2025-03-21 11:06:59 +01:00
2025-03-19 16:24:18 +01:00
2025-03-21 10:58:40 +01:00
2025-03-19 16:24:18 +01:00
2025-03-19 16:24:18 +01:00
2017-06-12 08:07:54 +02:00
2025-02-19 13:45:35 +01:00
2025-01-09 16:08:44 +01:00
2025-03-15 17:13:02 +01:00
2025-03-21 15:01:17 +01:00
2025-02-26 15:26:49 +01:00
2024-07-14 11:21:52 +02:00
2019-08-20 22:01:12 +02:00
2024-10-08 14:03:54 +02:00
2024-10-15 17:13:29 +01:00

Spring Framework Build Status Revved up by Develocity

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 of the reference documentation 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@spring.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 𝕏. In-depth articles can be found at The Spring Blog, and releases are announced via our releases feed.

License

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

Description
No description provided
Readme 248 MiB
Languages
Java 99.4%
XSLT 0.2%
AspectJ 0.2%