Skip to content

Commit 133b4c3

Browse files
committed
java.lang.ClassNotFoundException: kotlin.reflect.full.KClasses when upgrade from 2.8.9 to 2.8.10. Fixes #3064
1 parent e1b9f71 commit 133b4c3

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration/SpringDocKotlinConfiguration.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,6 @@ class SpringDocKotlinConfiguration() {
6969
.addDeprecatedType(Deprecated::class.java)
7070
}
7171

72-
@Bean
73-
@ConditionalOnProperty(
74-
name = [Constants.SPRINGDOC_NULLABLE_REQUEST_PARAMETER_ENABLED],
75-
matchIfMissing = true
76-
)
77-
@Lazy(false)
78-
fun kotlinDefaultsInParamObjects(): DelegatingMethodParameterCustomizer =
79-
DelegatingMethodParameterCustomizer { _, mp ->
80-
val kProp = mp.containingClass.kotlin.primaryConstructor
81-
?.parameters
82-
?.firstOrNull { it.name == mp.parameterName }
83-
if (kProp?.isOptional == true)
84-
(mp as DelegatingMethodParameter).isNotRequired = true
85-
}
86-
8772
@ConditionalOnClass(name = ["kotlin.reflect.full.KClasses"])
8873
class KotlinReflectDependingConfiguration {
8974

@@ -100,6 +85,21 @@ class SpringDocKotlinConfiguration() {
10085
fun kotlinModelConverter(objectMapperProvider: ObjectMapperProvider): KotlinInlineClassUnwrappingConverter {
10186
return KotlinInlineClassUnwrappingConverter(objectMapperProvider)
10287
}
88+
89+
@Bean
90+
@ConditionalOnProperty(
91+
name = [Constants.SPRINGDOC_NULLABLE_REQUEST_PARAMETER_ENABLED],
92+
matchIfMissing = true
93+
)
94+
@Lazy(false)
95+
fun kotlinDefaultsInParamObjects(): DelegatingMethodParameterCustomizer =
96+
DelegatingMethodParameterCustomizer { _, mp ->
97+
val kProp = mp.containingClass.kotlin.primaryConstructor
98+
?.parameters
99+
?.firstOrNull { it.name == mp.parameterName }
100+
if (kProp?.isOptional == true)
101+
(mp as DelegatingMethodParameter).isNotRequired = true
102+
}
103103
}
104104

105105
}

0 commit comments

Comments
 (0)