spring-attic / spring-native

Spring Native is now superseded by Spring Boot 3 official native support
https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html
Apache License 2.0
2.74k stars 355 forks source link

Add reflection hints for beans registered via Kotlin BeanDefinitionDsl #1680

Closed vladimirfx closed 2 years ago

vladimirfx commented 2 years ago

As of version 0.12.1 such bean definitions requires manual type hists:

val coroutinesInitializer: ApplicationContextInitializer<GenericApplicationContext> = beans {
    bean<ApplicationCoroutineScope>(destroyMethodName = "stop")
}

Workaround:

@TypeHint(
    types = [
        ApplicationCoroutineScope::class,
    ],
    typeNames = [
        "kotlin.internal.jdk8.JDK8PlatformImplementations",
    ],
    access = [TypeAccess.DECLARED_METHODS, TypeAccess.DECLARED_CONSTRUCTORS]
)
mhalbritter commented 2 years ago

Yes, this is not supported and won't be supported in Spring Native. Spring Boot 3 / Spring Framework 6 should find those beans IIRC. @sdeleuze what do you think?

sdeleuze commented 2 years ago

Yeah worth to check using latest Spring Framework 6 and Spring Boot 3 snapshots and raise issues if needed.

vladimirfx commented 2 years ago

This project is discontinued and development is continued in Spring Boot 3/ Framework 6?

mhalbritter commented 2 years ago

No, it's not discontinued. Spring Native is in minimal maintenance mode. We are currently investing our development time in AOT/native support in Spring Boot 3/Framework 6. But if there are serious issues in Spring Native, they will get fixed.