Background
Context Parameters were introduced in Kotlin 2.1.20 and are currently in Beta status in Kotlin 2.2.0 under the flag -Xcontext-parameters (announcement)
Issue
Spring's KotlinReflectionParameterNameDiscoverer cannot detect Context Parameters in Kotlin methods. The kotlinFunction property returns incomplete results - context parameters are completely absent from the reflection data.
Use Case
I'm migrating from Context Receivers to Context Parameters for implementing security via HandlerMethodArgumentResolver. My implementation:
- Uses a custom
UserContext class as a context parameter
- Injects it into controller handler methods
- Propagates it through service method calls
Technical Details
Expected
- Track support for Context Parameters in Spring Framework (if KT-78752 will be resolved)
- Add support for the new parameter kind coming in Kotlin 2.2.20 when reflection API is available
Background
Context Parameters were introduced in Kotlin 2.1.20 and are currently in Beta status in Kotlin 2.2.0 under the flag
-Xcontext-parameters(announcement)Issue
Spring's
KotlinReflectionParameterNameDiscoverercannot detect Context Parameters in Kotlin methods. ThekotlinFunctionproperty returns incomplete results - context parameters are completely absent from the reflection data.Use Case
I'm migrating from Context Receivers to Context Parameters for implementing security via
HandlerMethodArgumentResolver. My implementation:UserContextclass as a context parameterTechnical Details
kotlinFunction, hopefully in 2.1.22/2.2.10Expected