I need to execute block of code once upon startup on the Spock
tests. I cannot use @Autowired
in setupSpec()
which is default method for such initialisation, however @Bean
s would not be loaded till that time.
Found on web (dating back to 2015) source :
The behavior is a consequence of the design of Spring's TestContext framework. I don't see a way to change it without hitting other problems. The situation isn't any different when using the TestContext framework with JUnit.
It's been 6 years already, is there any clean way to do this? I want to omit dirty workarounds