Skip to content

Commit 8987ed1

Browse files
authored
Merge branch 'spring-projects:main' into main
2 parents 80b7215 + f5ff84a commit 8987ed1

File tree

146 files changed

+1650
-913
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+1650
-913
lines changed

.github/workflows/build-and-deploy-snapshot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
/**/framework-api-*.zip::zip.name=spring-framework,zip.deployed=false
2828
/**/framework-api-*-docs.zip::zip.type=docs
2929
/**/framework-api-*-schema.zip::zip.type=schema
30-
build-name: 'spring-framework-6.2.x'
30+
build-name: 'spring-framework-7.0.x'
3131
folder: 'deployment-repository'
3232
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
3333
repository: 'libs-snapshot-local'

.github/workflows/release-milestone.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Release Milestone
22
on:
33
push:
44
tags:
5-
- v6.2.0-M[1-9]
6-
- v6.2.0-RC[1-9]
5+
- v7.0.0-M[1-9]
6+
- v7.0.0-RC[1-9]
77
concurrency:
88
group: ${{ github.workflow }}-${{ github.ref }}
99
jobs:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22
on:
33
push:
44
tags:
5-
- v6.2.[0-9]+
5+
- v7.0.[0-9]+
66
concurrency:
77
group: ${{ github.workflow }}-${{ github.ref }}
88
jobs:

buildSrc/src/main/java/org/springframework/build/CheckstyleConventions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void apply(Project project) {
5050
project.getPlugins().apply(CheckstylePlugin.class);
5151
project.getTasks().withType(Checkstyle.class).forEach(checkstyle -> checkstyle.getMaxHeapSize().set("1g"));
5252
CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);
53-
checkstyle.setToolVersion("10.18.1");
53+
checkstyle.setToolVersion("10.20.1");
5454
checkstyle.getConfigDirectory().set(project.getRootProject().file("src/checkstyle"));
5555
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
5656
DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();

framework-docs/antora-playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ runtime:
3636
failure_level: warn
3737
ui:
3838
bundle:
39-
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.17/ui-bundle.zip
39+
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.4.18/ui-bundle.zip

framework-docs/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
**** xref:core/expressions/language-ref/constructors.adoc[]
6161
**** xref:core/expressions/language-ref/variables.adoc[]
6262
**** xref:core/expressions/language-ref/functions.adoc[]
63+
**** xref:core/expressions/language-ref/varargs.adoc[]
6364
**** xref:core/expressions/language-ref/bean-references.adoc[]
6465
**** xref:core/expressions/language-ref/operator-ternary.adoc[]
6566
**** xref:core/expressions/language-ref/operator-elvis.adoc[]

framework-docs/modules/ROOT/pages/core/aop-api/advice.adoc

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ arbitrary advice types. This section describes the basic concepts and standard a
3333
[[aop-api-advice-around]]
3434
=== Interception Around Advice
3535

36-
The most fundamental advice type in Spring is interception around advice.
36+
The most fundamental advice type in Spring is _interception around advice_.
3737

38-
Spring is compliant with the AOP `Alliance` interface for around advice that uses method
39-
interception. Classes that implement `MethodInterceptor` and that implement around advice should also implement the
40-
following interface:
38+
Spring is compliant with the AOP Alliance interface for around advice that uses method
39+
interception. Classes that implement around advice should therefore implement the
40+
following `MethodInterceptor` interface from the `org.aopalliance.intercept` package:
4141

4242
[source,java,indent=0,subs="verbatim,quotes"]
4343
----
@@ -49,8 +49,8 @@ following interface:
4949

5050
The `MethodInvocation` argument to the `invoke()` method exposes the method being
5151
invoked, the target join point, the AOP proxy, and the arguments to the method. The
52-
`invoke()` method should return the invocation's result: the return value of the join
53-
point.
52+
`invoke()` method should return the invocation's result: typically the return value of
53+
the join point.
5454

5555
The following example shows a simple `MethodInterceptor` implementation:
5656

@@ -64,9 +64,9 @@ Java::
6464
6565
public Object invoke(MethodInvocation invocation) throws Throwable {
6666
System.out.println("Before: invocation=[" + invocation + "]");
67-
Object rval = invocation.proceed();
67+
Object result = invocation.proceed();
6868
System.out.println("Invocation returned");
69-
return rval;
69+
return result;
7070
}
7171
}
7272
----
@@ -79,9 +79,9 @@ Kotlin::
7979
8080
override fun invoke(invocation: MethodInvocation): Any {
8181
println("Before: invocation=[$invocation]")
82-
val rval = invocation.proceed()
82+
val result = invocation.proceed()
8383
println("Invocation returned")
84-
return rval
84+
return result
8585
}
8686
}
8787
----
@@ -105,7 +105,7 @@ currently define pointcut interfaces.
105105
[[aop-api-advice-before]]
106106
=== Before Advice
107107

108-
A simpler advice type is a before advice. This does not need a `MethodInvocation`
108+
A simpler advice type is a _before advice_. This does not need a `MethodInvocation`
109109
object, since it is called only before entering the method.
110110

111111
The main advantage of a before advice is that there is no need to invoke the `proceed()`
@@ -122,10 +122,6 @@ The following listing shows the `MethodBeforeAdvice` interface:
122122
}
123123
----
124124

125-
(Spring's API design would allow for
126-
field before advice, although the usual objects apply to field interception and it is
127-
unlikely for Spring to ever implement it.)
128-
129125
Note that the return type is `void`. Before advice can insert custom behavior before the join
130126
point runs but cannot change the return value. If a before advice throws an
131127
exception, it stops further execution of the interceptor chain. The exception
@@ -176,10 +172,10 @@ TIP: Before advice can be used with any pointcut.
176172
[[aop-api-advice-throws]]
177173
=== Throws Advice
178174

179-
Throws advice is invoked after the return of the join point if the join point threw
175+
_Throws advice_ is invoked after the return of the join point if the join point threw
180176
an exception. Spring offers typed throws advice. Note that this means that the
181177
`org.springframework.aop.ThrowsAdvice` interface does not contain any methods. It is a
182-
tag interface identifying that the given object implements one or more typed throws
178+
marker interface identifying that the given object implements one or more typed throws
183179
advice methods. These should be in the following form:
184180

185181
[source,java,indent=0,subs="verbatim,quotes"]
@@ -189,9 +185,10 @@ advice methods. These should be in the following form:
189185

190186
Only the last argument is required. The method signatures may have either one or four
191187
arguments, depending on whether the advice method is interested in the method and
192-
arguments. The next two listing show classes that are examples of throws advice.
188+
arguments. The next two listings show classes that are examples of throws advice.
193189

194-
The following advice is invoked if a `RemoteException` is thrown (including from subclasses):
190+
The following advice is invoked if a `RemoteException` is thrown (including subclasses of
191+
`RemoteException`):
195192

196193
[tabs]
197194
======
@@ -220,9 +217,9 @@ Kotlin::
220217
----
221218
======
222219

223-
Unlike the preceding
224-
advice, the next example declares four arguments, so that it has access to the invoked method, method
225-
arguments, and target object. The following advice is invoked if a `ServletException` is thrown:
220+
Unlike the preceding advice, the next example declares four arguments, so that it has
221+
access to the invoked method, method arguments, and target object. The following advice
222+
is invoked if a `ServletException` is thrown:
226223

227224
[tabs]
228225
======
@@ -304,7 +301,7 @@ TIP: Throws advice can be used with any pointcut.
304301
[[aop-api-advice-after-returning]]
305302
=== After Returning Advice
306303

307-
An after returning advice in Spring must implement the
304+
An _after returning advice_ in Spring must implement the
308305
`org.springframework.aop.AfterReturningAdvice` interface, which the following listing shows:
309306

310307
[source,java,indent=0,subs="verbatim,quotes"]
@@ -368,7 +365,7 @@ TIP: After returning advice can be used with any pointcut.
368365
[[aop-api-advice-introduction]]
369366
=== Introduction Advice
370367

371-
Spring treats introduction advice as a special kind of interception advice.
368+
Spring treats _introduction advice_ as a special kind of interception advice.
372369

373370
Introduction requires an `IntroductionAdvisor` and an `IntroductionInterceptor` that
374371
implement the following interface:

framework-docs/modules/ROOT/pages/core/beans/context-introduction.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,11 +883,12 @@ for example, for processing all events asynchronously and/or for handling listen
883883
== Convenient Access to Low-level Resources
884884

885885
For optimal usage and understanding of application contexts, you should familiarize
886-
yourself with Spring's `Resource` abstraction, as described in xref:web/webflux-webclient/client-builder.adoc#webflux-client-builder-reactor-resources[Resources].
886+
yourself with Spring's `Resource` abstraction, as described in
887+
xref:core/resources.adoc[Resources].
887888

888889
An application context is a `ResourceLoader`, which can be used to load `Resource` objects.
889890
A `Resource` is essentially a more feature rich version of the JDK `java.net.URL` class.
890-
In fact, the implementations of the `Resource` wrap an instance of `java.net.URL`, where
891+
In fact, implementations of `Resource` wrap an instance of `java.net.URL`, where
891892
appropriate. A `Resource` can obtain low-level resources from almost any location in a
892893
transparent fashion, including from the classpath, a filesystem location, anywhere
893894
describable with a standard URL, and some other variations. If the resource location

framework-docs/modules/ROOT/pages/core/expressions/evaluation.adoc

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -444,18 +444,27 @@ component. This section discusses both of these options.
444444
The compiler can operate in one of three modes, which are captured in the
445445
`org.springframework.expression.spel.SpelCompilerMode` enum. The modes are as follows.
446446

447-
* `OFF` (default): The compiler is switched off.
448-
* `IMMEDIATE`: In immediate mode, the expressions are compiled as soon as possible. This
449-
is typically after the first interpreted evaluation. If the compiled expression fails
450-
(typically due to a type changing, as described earlier), the caller of the expression
451-
evaluation receives an exception.
452-
* `MIXED`: In mixed mode, the expressions silently switch between interpreted and
453-
compiled mode over time. After some number of interpreted runs, they switch to compiled
454-
form and, if something goes wrong with the compiled form (such as a type changing, as
455-
described earlier), the expression automatically switches back to interpreted form
456-
again. Sometime later, it may generate another compiled form and switch to it.
457-
Basically, the exception that the user gets in `IMMEDIATE` mode is instead handled
458-
internally.
447+
`OFF` ::
448+
The compiler is switched off, and all expressions will be evaluated in _interpreted_
449+
mode. This is the default mode.
450+
`IMMEDIATE` ::
451+
In immediate mode, expressions are compiled as soon as possible, typically after the
452+
first interpreted evaluation. If evaluation of the compiled expression fails (for
453+
example, due to a type changing, as described earlier), the caller of the expression
454+
evaluation receives an exception. If the types of various expression elements change
455+
over time, consider switching to `MIXED` mode or turning off the compiler.
456+
`MIXED` ::
457+
In mixed mode, expression evaluation silently switches between _interpreted_ and
458+
_compiled_ over time. After some number of successful interpreted runs, the expression
459+
gets compiled. If evaluation of the compiled expression fails (for example, due to a
460+
type changing), that failure will be caught internally, and the system will switch back
461+
to interpreted mode for the given expression. Basically, the exception that the caller
462+
receives in `IMMEDIATE` mode is instead handled internally. Sometime later, the
463+
compiler may generate another compiled form and switch to it. This cycle of switching
464+
between interpreted and compiled mode will continue until the system determines that it
465+
does not make sense to continue trying — for example, when a certain failure threshold
466+
has been reached — at which point the system will permanently switch to interpreted
467+
mode for the given expression.
459468

460469
`IMMEDIATE` mode exists because `MIXED` mode could cause issues for expressions that
461470
have side effects. If a compiled expression blows up after partially succeeding, it

framework-docs/modules/ROOT/pages/core/expressions/language-ref/constructors.adoc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,40 @@
33

44
You can invoke constructors by using the `new` operator. You should use the fully
55
qualified class name for all types except those located in the `java.lang` package
6-
(`Integer`, `Float`, `String`, and so on). The following example shows how to use the
7-
`new` operator to invoke constructors:
6+
(`Integer`, `Float`, `String`, and so on).
7+
xref:core/expressions/language-ref/varargs.adoc[Varargs] are also supported.
8+
9+
The following example shows how to use the `new` operator to invoke constructors.
810

911
[tabs]
1012
======
1113
Java::
1214
+
1315
[source,java,indent=0,subs="verbatim,quotes"]
1416
----
15-
Inventor einstein = p.parseExpression(
16-
"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
17+
Inventor einstein = parser.parseExpression(
18+
"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
1719
.getValue(Inventor.class);
1820
1921
// create new Inventor instance within the add() method of List
20-
p.parseExpression(
21-
"Members.add(new org.spring.samples.spel.inventor.Inventor(
22-
'Albert Einstein', 'German'))").getValue(societyContext);
22+
parser.parseExpression(
23+
"Members.add(new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German'))")
24+
.getValue(societyContext);
2325
----
2426
2527
Kotlin::
2628
+
2729
[source,kotlin,indent=0,subs="verbatim,quotes"]
2830
----
29-
val einstein = p.parseExpression(
30-
"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
31+
val einstein = parser.parseExpression(
32+
"new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German')")
3133
.getValue(Inventor::class.java)
3234
3335
// create new Inventor instance within the add() method of List
34-
p.parseExpression(
35-
"Members.add(new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German'))")
36+
parser.parseExpression(
37+
"Members.add(new org.spring.samples.spel.inventor.Inventor('Albert Einstein', 'German'))")
3638
.getValue(societyContext)
3739
----
3840
======
3941

4042

41-

framework-docs/modules/ROOT/pages/core/expressions/language-ref/functions.adoc

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
= Functions
33

44
You can extend SpEL by registering user-defined functions that can be called within
5-
expressions by using the `#functionName(...)` syntax. Functions can be registered as
6-
variables in `EvaluationContext` implementations via the `setVariable()` method.
5+
expressions by using the `#functionName(...)` syntax, and like with standard method
6+
invocations, xref:core/expressions/language-ref/varargs.adoc[varargs] are also supported
7+
for function invocations.
8+
9+
Functions can be registered as _variables_ in `EvaluationContext` implementations via the
10+
`setVariable()` method.
711

812
[TIP]
913
====
@@ -110,8 +114,9 @@ potentially more efficient use cases if the `MethodHandle` target and parameters
110114
been fully bound prior to registration; however, partially bound handles are also
111115
supported.
112116

113-
Consider the `String#formatted(String, Object...)` instance method, which produces a
114-
message according to a template and a variable number of arguments.
117+
Consider the `String#formatted(Object...)` instance method, which produces a message
118+
according to a template and a variable number of arguments
119+
(xref:core/expressions/language-ref/varargs.adoc[varargs]).
115120

116121
You can register and use the `formatted` method as a `MethodHandle`, as the following
117122
example shows:
@@ -151,10 +156,10 @@ Kotlin::
151156
----
152157
======
153158

154-
As hinted above, binding a `MethodHandle` and registering the bound `MethodHandle` is also
155-
supported. This is likely to be more performant if both the target and all the arguments
156-
are bound. In that case no arguments are necessary in the SpEL expression, as the
157-
following example shows:
159+
As mentioned above, binding a `MethodHandle` and registering the bound `MethodHandle` is
160+
also supported. This is likely to be more performant if both the target and all the
161+
arguments are bound. In that case no arguments are necessary in the SpEL expression, as
162+
the following example shows:
158163

159164
[tabs]
160165
======
@@ -168,9 +173,10 @@ Java::
168173
String template = "This is a %s message with %s words: <%s>";
169174
Object varargs = new Object[] { "prerecorded", 3, "Oh Hello World!", "ignored" };
170175
MethodHandle mh = MethodHandles.lookup().findVirtual(String.class, "formatted",
171-
MethodType.methodType(String.class, Object[].class))
176+
MethodType.methodType(String.class, Object[].class))
172177
.bindTo(template)
173-
.bindTo(varargs); //here we have to provide arguments in a single array binding
178+
// Here we have to provide the arguments in a single array binding:
179+
.bindTo(varargs);
174180
context.setVariable("message", mh);
175181
176182
// evaluates to "This is a prerecorded message with 3 words: <Oh Hello World!>"
@@ -189,9 +195,10 @@ Kotlin::
189195
val varargs = arrayOf("prerecorded", 3, "Oh Hello World!", "ignored")
190196
191197
val mh = MethodHandles.lookup().findVirtual(String::class.java, "formatted",
192-
MethodType.methodType(String::class.java, Array<Any>::class.java))
198+
MethodType.methodType(String::class.java, Array<Any>::class.java))
193199
.bindTo(template)
194-
.bindTo(varargs) //here we have to provide arguments in a single array binding
200+
// Here we have to provide the arguments in a single array binding:
201+
.bindTo(varargs)
195202
context.setVariable("message", mh)
196203
197204
// evaluates to "This is a prerecorded message with 3 words: <Oh Hello World!>"
@@ -201,4 +208,3 @@ Kotlin::
201208
======
202209

203210

204-

framework-docs/modules/ROOT/pages/core/expressions/language-ref/methods.adoc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[[expressions-methods]]
22
= Methods
33

4-
You can invoke methods by using typical Java programming syntax. You can also invoke methods
5-
on literals. Variable arguments are also supported. The following examples show how to
6-
invoke methods:
4+
You can invoke methods by using the typical Java programming syntax. You can also invoke
5+
methods directly on literals such as strings or numbers.
6+
xref:core/expressions/language-ref/varargs.adoc[Varargs] are supported as well.
7+
8+
The following examples show how to invoke methods.
79

810
[tabs]
911
======

0 commit comments

Comments
 (0)