Skip to content

Commit 3374d58

Browse files
committed
Migrate to Asciidoctor Tabs
1 parent 3bd79a8 commit 3374d58

18 files changed

+45
-225
lines changed

antora-playbook.yml

Lines changed: 1 addition & 3 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
- require: '@springio/antora-extensions/root-component-extension'
108
root_component_name: 'data-commons'
119
site:
@@ -35,5 +33,5 @@ runtime:
3533
format: pretty
3634
ui:
3735
bundle:
38-
url: https://github.com/spring-io/antora-ui-spring/releases/download/latest/ui-bundle.zip
36+
url: https://github.com/spring-io/antora-ui-spring/releases/download/v0.3.0/ui-bundle.zip
3937
snapshot: true

modules/ROOT/pages/auditing.adoc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Applications that only track creation and modification dates are not required do
1717
We provide `@CreatedBy` and `@LastModifiedBy` to capture the user who created or modified the entity as well as `@CreatedDate` and `@LastModifiedDate` to capture when the change happened.
1818

1919
.An audited entity
20-
====
2120
[source,java]
2221
----
2322
class Customer {
@@ -31,15 +30,13 @@ class Customer {
3130
// … further properties omitted
3231
}
3332
----
34-
====
3533

3634
As you can see, the annotations can be applied selectively, depending on which information you want to capture.
3735
The annotations, indicating to capture when changes are made, can be used on properties of type JDK8 date and time types, `long`, `Long`, and legacy Java `Date` and `Calendar`.
3836

3937
Auditing metadata does not necessarily need to live in the root level entity but can be added to an embedded one (depending on the actual store in use), as shown in the snippet below.
4038

4139
.Audit metadata in embedded entity
42-
====
4340
[source,java]
4441
----
4542
class Customer {
@@ -59,7 +56,6 @@ class AuditMetadata {
5956
6057
}
6158
----
62-
====
6359

6460
[[auditing.interfaces]]
6561
=== Interface-based Auditing Metadata
@@ -73,7 +69,6 @@ In case you use either `@CreatedBy` or `@LastModifiedBy`, the auditing infrastru
7369
The following example shows an implementation of the interface that uses Spring Security's `Authentication` object:
7470

7571
.Implementation of `AuditorAware` based on Spring Security
76-
====
7772
[source, java]
7873
----
7974
class SpringSecurityAuditorAware implements AuditorAware<User> {
@@ -89,7 +84,6 @@ class SpringSecurityAuditorAware implements AuditorAware<User> {
8984
}
9085
}
9186
----
92-
====
9387

9488
The implementation accesses the `Authentication` object provided by Spring Security and looks up the custom `UserDetails` instance that you have created in your `UserDetailsService` implementation. We assume here that you are exposing the domain user through the `UserDetails` implementation but that, based on the `Authentication` found, you could also look it up from anywhere.
9589

@@ -102,7 +96,6 @@ We provide an `ReactiveAuditorAware<T>` SPI interface that you have to implement
10296
The following example shows an implementation of the interface that uses reactive Spring Security's `Authentication` object:
10397

10498
.Implementation of `ReactiveAuditorAware` based on Spring Security
105-
====
10699
[source, java]
107100
----
108101
class SpringSecurityAuditorAware implements ReactiveAuditorAware<User> {
@@ -118,6 +111,5 @@ class SpringSecurityAuditorAware implements ReactiveAuditorAware<User> {
118111
}
119112
}
120113
----
121-
====
122114

123115
The implementation accesses the `Authentication` object provided by Spring Security and looks up the custom `UserDetails` instance that you have created in your `UserDetailsService` implementation. We assume here that you are exposing the domain user through the `UserDetails` implementation but that, based on the `Authentication` found, you could also look it up from anywhere.

modules/ROOT/pages/dependencies.adoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Due to the different inception dates of individual Spring Data modules, most of them carry different major and minor version numbers. The easiest way to find compatible ones is to rely on the Spring Data Release Train BOM that we ship with the compatible versions defined. In a Maven project, you would declare this dependency in the `<dependencyManagement />` section of your POM as follows:
55

66
.Using the Spring Data release train BOM
7-
====
87
[source, xml, subs="+attributes"]
98
----
109
<dependencyManagement>
@@ -19,7 +18,6 @@ Due to the different inception dates of individual Spring Data modules, most of
1918
</dependencies>
2019
</dependencyManagement>
2120
----
22-
====
2321

2422
[[dependencies.train-names]]
2523
[[dependencies.train-version]]
@@ -33,7 +31,6 @@ The version name follows `+${calver}+` for GA releases and service releases and
3331
You can find a working example of using the BOMs in our https://github.com/spring-projects/spring-data-examples/tree/main/bom[Spring Data examples repository]. With that in place, you can declare the Spring Data modules you would like to use without a version in the `<dependencies />` block, as follows:
3432

3533
.Declaring a dependency to a Spring Data module
36-
====
3734
[source, xml]
3835
----
3936
<dependencies>
@@ -43,7 +40,6 @@ You can find a working example of using the BOMs in our https://github.com/sprin
4340
</dependency>
4441
<dependencies>
4542
----
46-
====
4743

4844
[[dependencies.spring-boot]]
4945
== Dependency Management with Spring Boot

modules/ROOT/pages/entity-callbacks.adoc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ An `EntityCallback` is directly associated with its domain type through its gene
2424
Each Spring Data module typically ships with a set of predefined `EntityCallback` interfaces covering the entity lifecycle.
2525

2626
.Anatomy of an `EntityCallback`
27-
====
2827
[source,java]
2928
----
3029
@FunctionalInterface
@@ -44,10 +43,8 @@ public interface BeforeSaveCallback<T> extends EntityCallback<T> {
4443
<1> `BeforeSaveCallback` specific method to be called before an entity is saved. Returns a potentially modifed instance.
4544
<2> The entity right before persisting.
4645
<3> A number of store specific arguments like the _collection_ the entity is persisted to.
47-
====
4846

4947
.Anatomy of a reactive `EntityCallback`
50-
====
5148
[source,java]
5249
----
5350
@FunctionalInterface
@@ -67,14 +64,12 @@ public interface ReactiveBeforeSaveCallback<T> extends EntityCallback<T> {
6764
<1> `BeforeSaveCallback` specific method to be called on subscription, before an entity is saved. Emits a potentially modifed instance.
6865
<2> The entity right before persisting.
6966
<3> A number of store specific arguments like the _collection_ the entity is persisted to.
70-
====
7167

7268
NOTE: Optional entity callback parameters are defined by the implementing Spring Data module and inferred from call site of `EntityCallback.callback()`.
7369

7470
Implement the interface suiting your application needs like shown in the example below:
7571

7672
.Example `BeforeSaveCallback`
77-
====
7873
[source,java]
7974
----
8075
class DefaultingEntityCallback implements BeforeSaveCallback<Person>, Ordered { <2>
@@ -97,7 +92,6 @@ class DefaultingEntityCallback implements BeforeSaveCallback<Person>, Ordered {
9792
----
9893
<1> Callback implementation according to your requirements.
9994
<2> Potentially order the entity callback if multiple ones for the same domain type exist. Ordering follows lowest precedence.
100-
====
10195

10296
[[entity-callbacks.register]]
10397
== Registering Entity Callbacks
@@ -108,7 +102,6 @@ Most template APIs already implement `ApplicationContextAware` and therefore hav
108102
The following example explains a collection of valid entity callback registrations:
109103

110104
.Example `EntityCallback` Bean registration
111-
====
112105
[source,java]
113106
----
114107
@Order(1) <1>
@@ -164,4 +157,3 @@ class UserCallbacks implements BeforeConvertCallback<User>,
164157
<2> `BeforeSaveCallback` receiving its order via the `Ordered` interface implementation.
165158
<3> `BeforeSaveCallback` using a lambda expression. Unordered by default and invoked last. Note that callbacks implemented by a lambda expression do not expose typing information hence invoking these with a non-assignable entity affects the callback throughput. Use a `class` or `enum` to enable type filtering for the callback bean.
166159
<4> Combine multiple entity callback interfaces in a single implementation class.
167-
====

modules/ROOT/pages/kotlin-coroutines.adoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Spring Data modules provide support for Coroutines on the following scope:
1414
Coroutines support is enabled when `kotlinx-coroutines-core`, `kotlinx-coroutines-reactive` and `kotlinx-coroutines-reactor` dependencies are in the classpath:
1515

1616
.Dependencies to add in Maven pom.xml
17-
====
1817
[source,xml]
1918
----
2019
<dependency>
@@ -32,7 +31,6 @@ Coroutines support is enabled when `kotlinx-coroutines-core`, `kotlinx-coroutine
3231
<artifactId>kotlinx-coroutines-reactor</artifactId>
3332
</dependency>
3433
----
35-
====
3634

3735
NOTE: Supported versions `1.3.0` and above.
3836

@@ -62,7 +60,6 @@ Read this blog post about https://spring.io/blog/2019/04/12/going-reactive-with-
6260

6361
Here is an example of a Coroutines repository:
6462

65-
====
6663
[source,kotlin]
6764
----
6865
interface CoroutineRepository : CoroutineCrudRepository<User, String> {
@@ -74,7 +71,6 @@ interface CoroutineRepository : CoroutineCrudRepository<User, String> {
7471
suspend fun findAllByFirstname(id: String): List<User>
7572
}
7673
----
77-
====
7874

7975
Coroutines repositories are built on reactive repositories to expose the non-blocking nature of data access through Kotlin's Coroutines.
8076
Methods on a Coroutines repository can be backed either by a query method or a custom implementation.

modules/ROOT/pages/object-mapping.adoc

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ class Person {
113113
----
114114
115115
.A generated Property Accessor
116-
====
117116
[source, java]
118117
----
119118
class PersonPropertyAccessor implements PersistentPropertyAccessor {
@@ -140,7 +139,6 @@ class PersonPropertyAccessor implements PersistentPropertyAccessor {
140139
<2> By default, Spring Data uses field-access to read and write property values. As per visibility rules of `private` fields, `MethodHandles` are used to interact with fields.
141140
<3> The class exposes a `withId(…)` method that's used to set the identifier, e.g. when an instance is inserted into the datastore and an identifier has been generated. Calling `withId(…)` creates a new `Person` object. All subsequent mutations will take place in the new instance leaving the previous untouched.
142141
<4> Using property-access allows direct method invocations without using `MethodHandles`.
143-
====
144142
145143
This gives us a roundabout 25% performance boost over reflection.
146144
For the domain class to be eligible for such optimization, it needs to adhere to a set of constraints:
@@ -156,7 +154,6 @@ By default, Spring Data attempts to use generated property accessors and falls b
156154
Let's have a look at the following entity:
157155

158156
.A sample entity
159-
====
160157
[source, java]
161158
----
162159
class Person {
@@ -193,7 +190,6 @@ class Person {
193190
}
194191
}
195192
----
196-
====
197193
<1> The identifier property is final but set to `null` in the constructor.
198194
The class exposes a `withId(…)` method that's used to set the identifier, e.g. when an instance is inserted into the datastore and an identifier has been generated.
199195
The original `Person` instance stays unchanged as a new one is created.
@@ -230,7 +226,6 @@ It's an established pattern to rather use static factory methods to expose these
230226
Java's allows a flexible design of domain classes where a subclass could define a property that is already declared with the same name in its superclass.
231227
Consider the following example:
232228

233-
====
234229
[source,java]
235230
----
236231
public class SuperType {
@@ -272,7 +267,6 @@ public class SubType extends SuperType {
272267
}
273268
}
274269
----
275-
====
276270

277271
Both classes define a `field` using assignable types. `SubType` however shadows `SuperType.field`.
278272
Depending on the class design, using the constructor could be the only default approach to set `SuperType.field`.
@@ -315,16 +309,13 @@ Other constructors will be ignored.
315309

316310
Consider the following `data` class `Person`:
317311

318-
====
319312
[source,kotlin]
320313
----
321314
data class Person(val id: String, val name: String)
322315
----
323-
====
324316

325317
The class above compiles to a typical class with an explicit constructor.We can customize this class by adding another constructor and annotate it with `@PersistenceCreator` to indicate a constructor preference:
326318

327-
====
328319
[source,kotlin]
329320
----
330321
data class Person(var id: String, val name: String) {
@@ -333,17 +324,14 @@ data class Person(var id: String, val name: String) {
333324
constructor(id: String) : this(id, "unknown")
334325
}
335326
----
336-
====
337327

338328
Kotlin supports parameter optionality by allowing default values to be used if a parameter is not provided.
339329
When Spring Data detects a constructor with parameter defaulting, then it leaves these parameters absent if the data store does not provide a value (or simply returns `null`) so Kotlin can apply parameter defaulting.Consider the following class that applies parameter defaulting for `name`
340330

341-
====
342331
[source,kotlin]
343332
----
344333
data class Person(var id: String, val name: String = "unknown")
345334
----
346-
====
347335

348336
Every time the `name` parameter is either not part of the result or its value is `null`, then the `name` defaults to `unknown`.
349337

@@ -353,12 +341,10 @@ Every time the `name` parameter is either not part of the result or its value is
353341
In Kotlin, all classes are immutable by default and require explicit property declarations to define mutable properties.
354342
Consider the following `data` class `Person`:
355343

356-
====
357344
[source,kotlin]
358345
----
359346
data class Person(val id: String, val name: String)
360347
----
361-
====
362348

363349
This class is effectively immutable.
364350
It allows creating new instances as Kotlin generates a `copy(…)` method that creates new object instances copying all property values from the existing object and applying property values provided as arguments to the method.
@@ -368,7 +354,6 @@ It allows creating new instances as Kotlin generates a `copy(…)` method that c
368354

369355
Kotlin allows declaring https://kotlinlang.org/docs/inheritance.html#overriding-properties[property overrides] to alter properties in subclasses.
370356

371-
====
372357
[source,kotlin]
373358
----
374359
open class SuperType(open var field: Int)
@@ -377,13 +362,11 @@ class SubType(override var field: Int = 1) :
377362
SuperType(field) {
378363
}
379364
----
380-
====
381365

382366
Such an arrangement renders two properties with the name `field`.
383367
Kotlin generates property accessors (getters and setters) for each property in each class.
384368
Effectively, the code looks like as follows:
385369

386-
====
387370
[source,java]
388371
----
389372
public class SuperType {
@@ -421,7 +404,6 @@ public final class SubType extends SuperType {
421404
}
422405
}
423406
----
424-
====
425407

426408
Getters and setters on `SubType` set only `SubType.field` and not `SuperType.field`.
427409
In such an arrangement, using the constructor is the only default approach to set `SuperType.field`.
@@ -446,7 +428,6 @@ Spring Data can read and write types that define properties using Value Classes.
446428

447429
Consider the following domain model:
448430

449-
====
450431
[source,kotlin]
451432
----
452433
@JvmInline
@@ -457,7 +438,6 @@ data class Contact(val id: String, val name:String, val emailAddress: EmailAddre
457438

458439
<1> A simple value class with a non-nullable value type.
459440
<2> Data class defining a property using the `EmailAddress` value class.
460-
====
461441

462442
NOTE: Non-nullable properties using non-primitive value types are flattened in the compiled class to the value type.
463443
Nullable primitive value types or nullable value-in-value types are represented with their wrapper type and that affects how value types are represented in the database.

0 commit comments

Comments
 (0)