You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/auditing.adoc
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,14 @@
3
3
4
4
[[auditing.basics]]
5
5
== Basics
6
-
Spring Data provides sophisticated support to transparently keep track of who created or changed an entity and when the change happened.To benefit from that functionality, you have to equip your entity classes with auditing metadata that can be defined either using annotations or by implementing an interface.
6
+
Spring Data provides sophisticated support to transparently keep track of who created or changed an entity and when the change happened.
7
+
To benefit from that functionality, you have to equip your entity classes with auditing metadata that can be defined either using annotations or by implementing an interface.
7
8
Additionally, auditing has to be enabled either through Annotation configuration or XML configuration to register the required infrastructure components.
8
9
Please refer to the store-specific section for configuration samples.
9
10
10
11
[NOTE]
11
12
====
12
-
Applications that only track creation and modification dates are not required do make their entities implement <<auditing.auditor-aware,`AuditorAware`>>.
13
+
Applications that only track creation and modification dates are not required to make their entities implement <<auditing.auditor-aware,`AuditorAware`>>.
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/kotlin.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ https://kotlinlang.org[Kotlin] is a statically typed language that targets the J
6
6
7
7
Spring Data provides first-class support for Kotlin and lets developers write Kotlin applications almost as if Spring Data was a Kotlin native framework.
8
8
9
-
The easiest way to build a Spring application with Kotlin is to leverage Spring Boot and its https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-kotlin.html[dedicated Kotlin support].
9
+
The easiest way to build a Spring application with Kotlin is to leverage Spring Boot and its https://docs.spring.io/spring-boot/reference/features/kotlin.html[dedicated Kotlin support].
10
10
This comprehensive https://spring.io/guides/tutorials/spring-boot-kotlin/[tutorial] will teach you how to build Spring Boot applications with Kotlin using https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io].
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/kotlin/null-safety.adoc
+11-12Lines changed: 11 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,17 @@ One of Kotlin's key features is https://kotlinlang.org/docs/null-safety.html[nul
5
5
This makes applications safer through nullability declarations and the expression of "`value or no value`" semantics without paying the cost of wrappers, such as `Optional`.
6
6
(Kotlin allows using functional constructs with nullable values. See this https://www.baeldung.com/kotlin/null-safety[comprehensive guide to Kotlin null safety].)
7
7
8
-
Although Java does not let you express null safety in its type system, Spring Data API is annotated with https://jcp.org/en/jsr/detail?id=305[JSR-305] tooling friendly annotations declared in the `org.springframework.lang` package.
9
-
By default, types from Java APIs used in Kotlin are recognized as https://kotlinlang.org/docs/reference/java-interop.html#null-safety-and-platform-types[platform types], for which null checks are relaxed.
10
-
https://kotlinlang.org/docs/reference/java-interop.html#jsr-305-support[Kotlin support for JSR-305 annotations] and Spring nullability annotations provide null safety for the whole Spring Data API to Kotlin developers, with the advantage of dealing with `null` related issues at compile time.
11
-
12
-
See xref:repositories/null-handling.adoc[Null Handling of Repository Methods] how null safety applies to Spring Data Repositories.
13
-
14
-
[TIP]
8
+
[NOTE]
15
9
====
16
-
You can configure JSR-305 checks by adding the `-Xjsr305` compiler flag with the following options: `-Xjsr305={strict|warn|ignore}`.
17
-
18
-
For Kotlin versions 1.1+, the default behavior is the same as `-Xjsr305=warn`.
19
-
The `strict` value is required take Spring Data API null-safety into account. Kotlin types inferred from Spring API but should be used with the knowledge that Spring API nullability declaration could evolve, even between minor releases and that more checks may be added in the future.
10
+
As of Spring Framework 7 and Spring Data 4, Spring Data uses https://jspecify.dev/docs/start-here/[JSpecify] for nullability annotations.
11
+
The earlier https://jcp.org/en/jsr/detail?id=305[JSR-305]-based `org.springframework.lang` annotations are deprecated and should no longer be relied upon.
12
+
See xref:repositories/null-handling.adoc[Null Handling of Repository Methods] for the current recommended approach.
20
13
====
21
14
22
-
NOTE: Generic type arguments, varargs, and array elements nullability are not supported yet, but should be in an upcoming release.
15
+
Although Java does not let you express null safety in its type system, the Spring Data API is annotated with JSpecify annotations.
16
+
By default, types from Java APIs used in Kotlin are recognized as https://kotlinlang.org/docs/reference/java-interop.html#null-safety-and-platform-types[platform types], for which null checks are relaxed.
17
+
JSpecify annotations provide null safety for the whole Spring Data API to Kotlin developers, with the advantage of dealing with `null`-related issues at compile time.
18
+
19
+
See xref:repositories/null-handling.adoc[Null Handling of Repository Methods] for details on how null safety applies to Spring Data repositories.
20
+
21
+
NOTE: Generic type arguments, varargs, and array element nullability are not supported yet, but should be in an upcoming release.
Spring Data supports Kotlin 1.3 and requires `kotlin-stdlib` (or one of its variants, such as `kotlin-stdlib-jdk8`) and `kotlin-reflect` to be present on the classpath.
5
-
Those are provided by default if you bootstrap a Kotlin project via https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io].
4
+
Spring Data supports Kotlin 1.9 and above and requires `kotlin-stdlib` and `kotlin-reflect` to be present on the classpath.
5
+
Those are provided by default if you bootstrap a Kotlin project via https://start.spring.io/#!language=kotlin&type=gradle-project[start.spring.io].
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/object-mapping.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -214,7 +214,7 @@ If you want Spring Data to use the factory method for object instantiation, anno
214
214
== General recommendations
215
215
216
216
* _Try to stick to immutable objects_ -- Immutable objects are straightforward to create as materializing an object is then a matter of calling its constructor only.
217
-
Also, this avoids your domain objects to be littered with setter methods that allow client code to manipulate the objects state.
217
+
Also, this avoids littering your domain objects with setter methods that allow client code to manipulate the object's state.
218
218
If you need those, prefer to make them package protected so that they can only be invoked by a limited amount of co-located types.
219
219
Constructor-only materialization is up to 30% faster than properties population.
220
220
* _Provide an all-args constructor_ -- Even if you cannot or don't want to model your entities as immutable values, there's still value in providing a constructor that takes all properties of the entity as arguments, including the mutable ones, as this allows the object mapping to skip the property population for optimal performance.
0 commit comments