import com.test.ApplicationConfiguration
import org.springframework.context.annotation.AnnotationConfigApplicationContext
...
def activeProfile = 'test'
def ctx = new AnnotationConfigApplicationContext()
ctx.getEnvironment().setActiveProfiles(activeProfile)
ctx.register(ApplicationConfiguration)
ctx.refresh()
...
ctx.close()