Find Spring Data repository methods returning Optional<T>

Proprietary

On the JVM, Optional<T> is the only way to model 'maybe absent' in Java APIs. In Kotlin, T? is the language-native equivalent — Spring Data auto-detects nullable return types since 2.0. Convert Optional<T> returns to T?.

org.openrewrite.kotlin.spring.FindRepositoryReturnsOptional$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.spring.FindRepositoryReturnsOptional$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.