spring-fu: Spring Boot 3.0.0 seems to break kofu
Hi there, in my super small project, I made an update to Spring 3.0.0 and now it seems like Spring-Fu cannot find the application context correctly.
The first exception I got was:
isbn-stacks-kofu | . ____ _ __ _ _
isbn-stacks-kofu | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
isbn-stacks-kofu | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
isbn-stacks-kofu | \\/ ___)| |_)| | | | | || (_| | ) ) ) )
isbn-stacks-kofu | ' |____| .__|_| |_|_| |_\__, | / / / /
isbn-stacks-kofu | =========|_|==============|___/=/_/_/_/
isbn-stacks-kofu | :: Spring Boot :: (v3.0.0)
isbn-stacks-kofu |
isbn-stacks-kofu | 2022-11-29T17:24:02.658Z ERROR 7 --- [ main] o.s.boot.SpringApplication : Application run failed
isbn-stacks-kofu |
isbn-stacks-kofu | java.lang.IllegalArgumentException: Could not find class [org.jesperancinha.spring.ISBNStacksKoFuReactiveLauncher$Companion__ApplicationContextInitializer]
isbn-stacks-kofu | at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:333) ~[spring-core-6.0.2.jar!/:6.0.2]
isbn-stacks-kofu | at org.springframework.context.aot.AotApplicationContextInitializer.instantiateInitializer(AotApplicationContextInitializer.java:80) ~[spring-context-6.0.2.jar!/:6.0.2]
isbn-stacks-kofu | at org.springframework.context.aot.AotApplicationContextInitializer.initialize(AotApplicationContextInitializer.java:71) ~[spring-context-6.0.2.jar!/:6.0.2]
isbn-stacks-kofu | at org.springframework.context.aot.AotApplicationContextInitializer.lambda$forInitializerClasses$0(AotApplicationContextInitializer.java:61) ~[spring-context-6.0.2.jar!/:6.0.2]
isbn-stacks-kofu | at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:603) ~[spring-boot-3.0.0.jar!/:3.0.0]
isbn-stacks-kofu | at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:383) ~[spring-boot-3.0.0.jar!/:3.0.0]
isbn-stacks-kofu | at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-3.0.0.jar!/:3.0.0]
isbn-stacks-kofu | at org.springframework.fu.kofu.KofuApplication.run(KofuApplication.kt:50) ~[spring-fu-kofu-0.5.1.jar!/:na]
isbn-stacks-kofu | at org.springframework.fu.kofu.KofuApplication.run$default(KofuApplication.kt:34) ~[spring-fu-kofu-0.5.1.jar!/:na]
isbn-stacks-kofu | at org.jesperancinha.spring.ISBNStacksKoFuReactiveLauncher$Companion.main(ISBNStacksKoFuReactiveLauncher.kt:48) ~[classes!/:na]
isbn-stacks-kofu | at org.jesperancinha.spring.ISBNStacksKoFuReactiveLauncher.main(ISBNStacksKoFuReactiveLauncher.kt) ~[classes!/:na]
isbn-stacks-kofu | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
isbn-stacks-kofu | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
isbn-stacks-kofu | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
isbn-stacks-kofu | at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
isbn-stacks-kofu | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | at org.springframework.boot.loader.Launcher.launch(Launcher.java:95) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | Caused by: java.lang.ClassNotFoundException: org.jesperancinha.spring.ISBNStacksKoFuReactiveLauncher$Companion__ApplicationContextInitializer
isbn-stacks-kofu | at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:432) ~[na:na]
isbn-stacks-kofu | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:586) ~[na:na]
isbn-stacks-kofu | at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | at org.springframework.fu.kofu.KofuApplication.run(KofuApplication.kt:50) ~[spring-fu-kofu-0.5.1.jar!/:na]
isbn-stacks-kofu | at org.springframework.fu.kofu.KofuApplication.run$default(KofuApplication.kt:34) ~[spring-fu-kofu-0.5.1.jar!/:na]
isbn-stacks-kofu | at org.jesperancinha.spring.ISBNStacksKoFuReactiveLauncher$Companion.main(ISBNStacksKoFuReactiveLauncher.kt:48) ~[classes!/:na]
isbn-stacks-kofu | at org.jesperancinha.spring.ISBNStacksKoFuReactiveLauncher.main(ISBNStacksKoFuReactiveLauncher.kt) ~[classes!/:na]
isbn-stacks-kofu | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
isbn-stacks-kofu | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
isbn-stacks-kofu | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
isbn-stacks-kofu | at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
isbn-stacks-kofu | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | at org.springframework.boot.loader.Launcher.launch(Launcher.java:95) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | Caused by: java.lang.ClassNotFoundException: org.jesperancinha.spring.ISBNStacksKoFuReactiveLauncher$Companion__ApplicationContextInitializer
isbn-stacks-kofu | at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:432) ~[na:na]
isbn-stacks-kofu | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:586) ~[na:na]
isbn-stacks-kofu | at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:149) ~[isbn-stacks-rest-kofu-mvc-reactive.jar:na]
isbn-stacks-kofu | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[na:na]
isbn-stacks-kofu | at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
isbn-stacks-kofu | at java.base/java.lang.Class.forName(Class.java:466) ~[na:na]
isbn-stacks-kofu | at org.springframework.util.ClassUtils.forName(ClassUtils.java:283) ~[spring-core-6.0.2.jar!/:6.0.2]
isbn-stacks-kofu | at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:323) ~[spring-core-6.0.2.jar!/:6.0.2]
isbn-stacks-kofu | ... 18 common frames omitted
And now, with my fix:
class ISBNStacksNothingLauncher{
companion object{
@JvmStatic
fun main(args: Array<String>) {
app.run()
}
}
class Companion__ApplicationContextInitializer :
AotApplicationContextInitializer<ReactiveWebServerApplicationContext> {
override fun initialize(applicationContext: ReactiveWebServerApplicationContext) {
applicationContext.registerBean(SampleHandler::class.java, *arrayOf())
}
}
}
which does not fix anything apparently, I’m getting this:
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.springframework.boot.autoconfigure.jackson.JacksonInitializer.lambda$initialize$0(JacksonInitializer.java:44)
The following method did not exist:
The project is located here: https://github.com/jesperancinha/isbn-stacks
And the first error you can see it here: https://github.com/jesperancinha/isbn-stacks/actions/runs/3576450272/jobs/6014271816
Maybe I’m missing a dependency or maybe this has a new configuration with Spring 3.0.0? Let me know! thanks in advance!
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15
Short term no, we will decide in 2023 if we upgrade or not.
If you find a relevant place in Spring Boot refdoc where that make sense, feel free to submit a PR and the Spring Boot team will evaluate if that makes sense from their POV or not.
Hi, the status is still the one shared in the README, not much update to share yet as we are working on other priorities:
Most of the DSL are documented at Spring Framework level, see https://docs.spring.io/spring-framework/reference/languages/kotlin.html.
Should be upgraded to Java 17 as this is a requirement for Spring Boot 3 and Spring Framework 6.
Many thanks for the update on KoFu and the link to the DSL documentation! It’s all absolutely clear now.
Just a follow up question regarding documentation best practices in Spring Boot - shall one consider mentioning of this Spring Framework in the Spring Boot documentation as I believe it’s where people normally will be looking for it?
Hey there! I’ve been working on a fork of spring-fu project called kofu 😄. Its goal is to adapt a subset of this project for use with Spring Boot 3. It’s nowhere near completion yet most of the unit tests from spring-fu complete successfully. You can find it here: https://github.com/nk2IsHere/kofu.
Great thanks, I’ve made a fork out of this project and will try in my free time to get this to work: https://github.com/jesperancinha/spring-fu
There is a lot of usage of some old dependencies and Javax, so this will be a nice challenge to go through 😃
Hi, yes, if somebody takes the time to craft a PR to upgrade Spring Fu to Spring Boot 3 and Spring Framework 6 I can review/merge it. It should support both JaFu and KoFu to be mergeable.