reik.schatz
01/08/2019, 9:31 AMlateinit var
way to the @Autowired val
constructor way (junit5). one test class with 4 test method can now only execute 1 test method successfully. the other ones are failing with No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available
. What makes this test class different, is a @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
annotation. I am also running with junit.jupiter.testinstance.lifecycle.default=per_class
. Maybe all of this doesn’t play nice together?sdeleuze
01/09/2019, 11:17 AM@DirtiesContext
before or after test methods.sdeleuze
01/09/2019, 11:18 AMApplicationContext
, and DI will not occur again (to reset the references) since the constructor will only be invoked once.sdeleuze
01/09/2019, 11:19 AM@DirtiesContext
before or after methods, one must allow dependencies from Spring to be injected via fields or setter/configuration methods.sdeleuze
01/09/2019, 11:20 AMreik.schatz
01/09/2019, 12:30 PM