-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)theme: aotAn issue related to Ahead-of-time processingAn issue related to Ahead-of-time processingtheme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin supporttype: enhancementA general enhancementA general enhancement
Milestone
Description
Take the following kotlin @Service
:
@Service
class Service(
private val applicationContext: ApplicationContext,
private val client: Client = Client()
)
When running on JVM the code behaves as expected: only the constructor parameter without a default value is autowired.
When running the native image the application does not start and throws the following exception indicating that spring
attempts to autowire all constructor parameters (even the one with a default value):
java.lang.NullPointerException: Parameter specified as non-null is null: method de.darkatra.kotlindiissue.Service.<init>, parameter client
Reproducer with details: https://github.com/DarkAtra/spring-native-kotlin-di-issue
Affected Spring Framework versions: 6.0.2
, 6.0.3
, 6.0.4
(verified by building the current spring-boot main branch locally)
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)theme: aotAn issue related to Ahead-of-time processingAn issue related to Ahead-of-time processingtheme: kotlinAn issue related to Kotlin supportAn issue related to Kotlin supporttype: enhancementA general enhancementA general enhancement