diff --git a/integration-test/src/test/java/org/cloudfoundry/IntegrationTestConfiguration.java b/integration-test/src/test/java/org/cloudfoundry/IntegrationTestConfiguration.java index 1aff721143..12571face1 100644 --- a/integration-test/src/test/java/org/cloudfoundry/IntegrationTestConfiguration.java +++ b/integration-test/src/test/java/org/cloudfoundry/IntegrationTestConfiguration.java @@ -82,12 +82,14 @@ import org.cloudfoundry.util.ResourceUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; +import org.springframework.context.annotation.Lazy; import org.springframework.core.io.ClassPathResource; import org.springframework.util.StringUtils; import reactor.core.publisher.Flux; @@ -95,6 +97,15 @@ import reactor.util.function.Tuple2; import reactor.util.function.Tuples; +/** + * Default configuration class for ALL integration tests. + *
+ * Some beans are annotated as {@link Lazy}, meaning that they will only be initialized
+ * if a test class actually uses them through {@link Autowired} injection. This allows us
+ * to declare some CF applications as beans, but only push them when they are actually
+ * used by the class under tests. This makes our tests faster, as pushing an app can take
+ * several minutes.
+ */
@Configuration
@EnableAutoConfiguration
public class IntegrationTestConfiguration {
@@ -460,6 +471,7 @@ Version serverVersion(@Qualifier("admin") CloudFoundryClient cloudFoundryClient)
.block();
}
+ @Lazy
@Bean(initMethod = "block")
@DependsOn("cloudFoundryCleaner")
Mono