Skip to content

Commit 7bb3c49

Browse files
committed
Migrate to Asciidoctor Tabs
1 parent 826c603 commit 7bb3c49

File tree

243 files changed

+7118
-1773
lines changed

Some content is hidden

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

243 files changed

+7118
-1773
lines changed

framework-docs/antora-playbook.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
antora:
55
extensions:
66
- '@antora/collector-extension'
7-
- require: '@springio/antora-extensions/tabs-migration-extension'
8-
unwrap_example_block: always
97
site:
108
title: Spring Framework Reference
119
url: https://https://rwinch.github.io/spring-framework/

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

Lines changed: 72 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@ point.
5454

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

57+
[tabs]
58+
======
59+
Java::
60+
+
5761
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
58-
.Java
5962
----
6063
public class DebugInterceptor implements MethodInterceptor {
6164
@@ -67,8 +70,10 @@ The following example shows a simple `MethodInterceptor` implementation:
6770
}
6871
}
6972
----
73+
74+
Kotlin::
75+
+
7076
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
71-
.Kotlin
7277
----
7378
class DebugInterceptor : MethodInterceptor {
7479
@@ -80,6 +85,7 @@ The following example shows a simple `MethodInterceptor` implementation:
8085
}
8186
}
8287
----
88+
======
8389

8490
Note the call to the `proceed()` method of `MethodInvocation`. This proceeds down the
8591
interceptor chain towards the join point. Most interceptors invoke this method and
@@ -129,8 +135,11 @@ wrapped in an unchecked exception by the AOP proxy.
129135

130136
The following example shows a before advice in Spring, which counts all method invocations:
131137

138+
[tabs]
139+
======
140+
Java::
141+
+
132142
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
133-
.Java
134143
----
135144
public class CountingBeforeAdvice implements MethodBeforeAdvice {
136145
@@ -145,8 +154,10 @@ The following example shows a before advice in Spring, which counts all method i
145154
}
146155
}
147156
----
157+
158+
Kotlin::
159+
+
148160
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
149-
.Kotlin
150161
----
151162
class CountingBeforeAdvice : MethodBeforeAdvice {
152163
@@ -157,6 +168,7 @@ The following example shows a before advice in Spring, which counts all method i
157168
}
158169
}
159170
----
171+
======
160172

161173
TIP: Before advice can be used with any pointcut.
162174

@@ -181,8 +193,11 @@ arguments. The next two listing show classes that are examples of throws advice.
181193

182194
The following advice is invoked if a `RemoteException` is thrown (including from subclasses):
183195

196+
[tabs]
197+
======
198+
Java::
199+
+
184200
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
185-
.Java
186201
----
187202
public class RemoteThrowsAdvice implements ThrowsAdvice {
188203
@@ -191,8 +206,10 @@ The following advice is invoked if a `RemoteException` is thrown (including from
191206
}
192207
}
193208
----
209+
210+
Kotlin::
211+
+
194212
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
195-
.Kotlin
196213
----
197214
class RemoteThrowsAdvice : ThrowsAdvice {
198215
@@ -201,13 +218,17 @@ The following advice is invoked if a `RemoteException` is thrown (including from
201218
}
202219
}
203220
----
221+
======
204222

205223
Unlike the preceding
206224
advice, the next example declares four arguments, so that it has access to the invoked method, method
207225
arguments, and target object. The following advice is invoked if a `ServletException` is thrown:
208226

227+
[tabs]
228+
======
229+
Java::
230+
+
209231
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
210-
.Java
211232
----
212233
public class ServletThrowsAdviceWithArguments implements ThrowsAdvice {
213234
@@ -216,8 +237,10 @@ arguments, and target object. The following advice is invoked if a `ServletExcep
216237
}
217238
}
218239
----
240+
241+
Kotlin::
242+
+
219243
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
220-
.Kotlin
221244
----
222245
class ServletThrowsAdviceWithArguments : ThrowsAdvice {
223246
@@ -226,13 +249,17 @@ arguments, and target object. The following advice is invoked if a `ServletExcep
226249
}
227250
}
228251
----
252+
======
229253

230254
The final example illustrates how these two methods could be used in a single class
231255
that handles both `RemoteException` and `ServletException`. Any number of throws advice
232256
methods can be combined in a single class. The following listing shows the final example:
233257

258+
[tabs]
259+
======
260+
Java::
261+
+
234262
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
235-
.Java
236263
----
237264
public static class CombinedThrowsAdvice implements ThrowsAdvice {
238265
@@ -245,8 +272,10 @@ methods can be combined in a single class. The following listing shows the final
245272
}
246273
}
247274
----
275+
276+
Kotlin::
277+
+
248278
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
249-
.Kotlin
250279
----
251280
class CombinedThrowsAdvice : ThrowsAdvice {
252281
@@ -259,6 +288,7 @@ methods can be combined in a single class. The following listing shows the final
259288
}
260289
}
261290
----
291+
======
262292

263293
NOTE: If a throws-advice method throws an exception itself, it overrides the
264294
original exception (that is, it changes the exception thrown to the user). The overriding
@@ -292,8 +322,11 @@ the invoked method, the method's arguments, and the target.
292322
The following after returning advice counts all successful method invocations that have
293323
not thrown exceptions:
294324

325+
[tabs]
326+
======
327+
Java::
328+
+
295329
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
296-
.Java
297330
----
298331
public class CountingAfterReturningAdvice implements AfterReturningAdvice {
299332
@@ -309,8 +342,10 @@ not thrown exceptions:
309342
}
310343
}
311344
----
345+
346+
Kotlin::
347+
+
312348
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
313-
.Kotlin
314349
----
315350
class CountingAfterReturningAdvice : AfterReturningAdvice {
316351
@@ -322,6 +357,7 @@ not thrown exceptions:
322357
}
323358
}
324359
----
360+
======
325361

326362
This advice does not change the execution path. If it throws an exception, it is
327363
thrown up the interceptor chain instead of the return value.
@@ -380,24 +416,30 @@ introduced interfaces can be implemented by the configured `IntroductionIntercep
380416
Consider an example from the Spring test suite and suppose we want to
381417
introduce the following interface to one or more objects:
382418

419+
[tabs]
420+
======
421+
Java::
422+
+
383423
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
384-
.Java
385424
----
386425
public interface Lockable {
387426
void lock();
388427
void unlock();
389428
boolean locked();
390429
}
391430
----
431+
432+
Kotlin::
433+
+
392434
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
393-
.Kotlin
394435
----
395436
interface Lockable {
396437
fun lock()
397438
fun unlock()
398439
fun locked(): Boolean
399440
}
400441
----
442+
======
401443

402444
This illustrates a mixin. We want to be able to cast advised objects to `Lockable`,
403445
whatever their type and call lock and unlock methods. If we call the `lock()` method, we
@@ -434,8 +476,11 @@ to that held in the target object.
434476

435477
The following example shows the example `LockMixin` class:
436478

479+
[tabs]
480+
======
481+
Java::
482+
+
437483
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
438-
.Java
439484
----
440485
public class LockMixin extends DelegatingIntroductionInterceptor implements Lockable {
441486
@@ -462,8 +507,10 @@ The following example shows the example `LockMixin` class:
462507
463508
}
464509
----
510+
511+
Kotlin::
512+
+
465513
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
466-
.Kotlin
467514
----
468515
class LockMixin : DelegatingIntroductionInterceptor(), Lockable {
469516
@@ -490,6 +537,7 @@ The following example shows the example `LockMixin` class:
490537
491538
}
492539
----
540+
======
493541

494542
Often, you need not override the `invoke()` method. The
495543
`DelegatingIntroductionInterceptor` implementation (which calls the `delegate` method if
@@ -504,8 +552,11 @@ interceptor (which would be defined as a prototype). In this case, there is no
504552
configuration relevant for a `LockMixin`, so we create it by using `new`.
505553
The following example shows our `LockMixinAdvisor` class:
506554

555+
[tabs]
556+
======
557+
Java::
558+
+
507559
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
508-
.Java
509560
----
510561
public class LockMixinAdvisor extends DefaultIntroductionAdvisor {
511562
@@ -514,11 +565,14 @@ The following example shows our `LockMixinAdvisor` class:
514565
}
515566
}
516567
----
568+
569+
Kotlin::
570+
+
517571
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
518-
.Kotlin
519572
----
520573
class LockMixinAdvisor : DefaultIntroductionAdvisor(LockMixin(), Lockable::class.java)
521574
----
575+
======
522576

523577
We can apply this advisor very simply, because it requires no configuration. (However, it
524578
is impossible to use an `IntroductionInterceptor` without an

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ However you create AOP proxies, you can manipulate them BY using the
66
interface, no matter which other interfaces it implements. This interface includes the
77
following methods:
88

9+
[tabs]
10+
======
11+
Java::
12+
+
913
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
10-
.Java
1114
----
1215
Advisor[] getAdvisors();
1316
@@ -29,8 +32,10 @@ following methods:
2932
3033
boolean isFrozen();
3134
----
35+
36+
Kotlin::
37+
+
3238
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
33-
.Kotlin
3439
----
3540
fun getAdvisors(): Array<Advisor>
3641
@@ -59,6 +64,7 @@ following methods:
5964
6065
fun isFrozen(): Boolean
6166
----
67+
======
6268

6369
The `getAdvisors()` method returns an `Advisor` for every advisor, interceptor, or
6470
other advice type that has been added to the factory. If you added an `Advisor`, the
@@ -80,8 +86,11 @@ change. (You can obtain a new proxy from the factory to avoid this problem.)
8086
The following example shows casting an AOP proxy to the `Advised` interface and examining and
8187
manipulating its advice:
8288

89+
[tabs]
90+
======
91+
Java::
92+
+
8393
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
84-
.Java
8594
----
8695
Advised advised = (Advised) myObject;
8796
Advisor[] advisors = advised.getAdvisors();
@@ -98,8 +107,10 @@ manipulating its advice:
98107
99108
assertEquals("Added two advisors", oldAdvisorCount + 2, advised.getAdvisors().length);
100109
----
110+
111+
Kotlin::
112+
+
101113
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
102-
.Kotlin
103114
----
104115
val advised = myObject as Advised
105116
val advisors = advised.advisors
@@ -116,6 +127,7 @@ manipulating its advice:
116127
117128
assertEquals("Added two advisors", oldAdvisorCount + 2, advised.advisors.size)
118129
----
130+
======
119131

120132
NOTE: It is questionable whether it is advisable (no pun intended) to modify advice on a
121133
business object in production, although there are, no doubt, legitimate usage cases.

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,22 @@ an instance of the prototype from the factory. Holding a reference is not suffic
192192
The `person` bean definition shown earlier can be used in place of a `Person` implementation, as
193193
follows:
194194

195+
[tabs]
196+
======
197+
Java::
198+
+
195199
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
196-
.Java
197200
----
198201
Person person = (Person) factory.getBean("person");
199202
----
203+
204+
Kotlin::
205+
+
200206
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
201-
.Kotlin
202207
----
203208
val person = factory.getBean("person") as Person;
204209
----
210+
======
205211

206212
Other beans in the same IoC context can express a strongly typed dependency on it, as
207213
with an ordinary Java object. The following example shows how to do so:

0 commit comments

Comments
 (0)