I upgraded from Spring Boot 2.0.6 to 2.1.3 and now...
# spring
p
I upgraded from Spring Boot 2.0.6 to 2.1.3 and now my test beans defined in mockk suddenly stopped working.
Copy code
Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class com.example.core.feature.general.MyService$ByteBuddy$XNiBjGz8$ByteBuddy$rk2gOXmp: Common causes of this problem include using a final class or a non-visible class; nested exception is org.springframework.cglib.core.CodeGenerationException: java.lang.NoClassDefFoundError-->com/example/core/feature/general/MyService$ByteBuddy$XNiBjGz8$ByteBuddy$rk2gOXmp
I found this: https://github.com/raphw/byte-buddy/issues/486 Could it be somehow related to ByteBuddy? I know that Spring Boot now supports Java 11 for the first time. This is how I define my test mocks.. used to work perfectly:
Copy code
@Bean
fun myService() = mockk<MyService>(relaxed = true)
Alrighty, can be fixed by upgrading MockK to the latest. mockk 1.9 upgrades byte buddy to similar version used throughout spring which eliminates this bug.
j
You might want to use SpringMockK: https://github.com/Ninja-Squad/springmockk
189 Views