Because setupSpec() and cleanupSpec() are destined to hold only long-lived objects that span all the test methods, Spock allows code in these methods to access only static fields (not recommended) and objects marked as @Shared, as you’ll see in the next section.