I'm relatively new to kotlin and I can't get my head around spring autowiring
kotlin.UninitializedPropertyAccessException: lateinit property applicationContext has not been initialized
I got the above error while running this:
@SpringBootTest
internal class MeterResourceAdapterTest () {
@Autowired
private lateinit var applicationContext: ApplicationContext
@Test
fun toMeterReadingResourceList() {
print(applicationContext.applicationName)
.....//I hope my implementation can be ignored
}
What is going on here? Why, incidentally, is lateinit required, and WHEN does 'it' get initialised?