I try to test something in a Kotlin project using JUnit 5 and Spring Boot, but I'm unable to inject a bean in my test class.
I tried many different annotations, but the injection nerver worked...
Here's my test class:
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@SpringBootTest
@ExtendWith(SpringExtension::class)
class FooTest {
@Autowired
lateinit var repo: BarRepository
@BeforeAll
fun setup() {
}
@Test
fun testToto() {
}
}
With this annotations combination, the code raises the following exception:
java.lang.NoClassDefFoundError:org/springframework/boot/context/properties/source/ConfigurationPropertySource.
And I'm actually unable to find where does this exception come from... I tried to do some research about this exception, but I didn't find anything satisfying...