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: spring-boot-project/spring-boot-docs/src/docs/antora/modules/reference/pages/features/kotlin.adoc
+5-2
Original file line number
Diff line number
Diff line change
@@ -114,8 +114,7 @@ TIP: `org.jetbrains.kotlinx:kotlinx-coroutines-reactor` dependency is provided b
114
114
115
115
[[features.kotlin.configuration-properties]]
116
116
== @ConfigurationProperties
117
-
118
-
`@ConfigurationProperties` when used in combination with xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties.constructor-binding[constructor binding] supports classes with immutable `val` properties as shown in the following example:
117
+
`@ConfigurationProperties` when used in combination with xref:features/external-config.adoc#features.external-config.typesafe-configuration-properties.constructor-binding[constructor binding] supports data classes with immutable `val` properties as shown in the following example:
119
118
120
119
[source,kotlin]
121
120
----
@@ -132,6 +131,10 @@ data class KotlinExampleProperties(
132
131
}
133
132
----
134
133
134
+
Due to the limitations of their interoperability with Java, support for value classes is limited.
135
+
In particular, relying upon a value class's default value will not work with configuration property binding.
136
+
In such cases, a data class should be used instead.
137
+
135
138
TIP: To generate xref:specification:configuration-metadata/annotation-processor.adoc[your own metadata] using the annotation processor, {url-kotlin-docs}/kapt.html[`kapt` should be configured] with the `spring-boot-configuration-processor` dependency.
136
139
Note that some features (such as detecting the default value or deprecated items) are not working due to limitations in the model kapt provides.
0 commit comments