The problem is that Spock Spring is looking for Spring’s @ContextConfiguration
annotation and doesn’t manage to find it. Strictly speaking MyTestSpec
is annotated with @ContextConfiguration
as it’s a meta-annotation on @SpringApplicationConfiguration
but Spock Spring doesn’t consider meta-annotations as part of its search. There’s an issue to address this limitation. In the meantime you can work around it.
All that @SpringApplicationConfiguration
is doing is customising @ContextConfiguration
with a Boot-specific context loader. This means that you can achieve the same effect by using an appropriately configured @ContextConfiguration
annotation instead:
@ContextConfiguration(loader = SpringApplicationContextLoader.class, classes = MyServer.class)
@WebAppConfiguration
@IntegrationTest
class MyTestSpec extends Specification {
…
}
Update: Just to make sure it’s clear (and based on the comments, it wasn’t), for this to work you need to have org.spockframework:spock-spring
on the classpath.