|
82 | 82 | import org.cloudfoundry.util.ResourceUtils;
|
83 | 83 | import org.slf4j.Logger;
|
84 | 84 | import org.slf4j.LoggerFactory;
|
| 85 | +import org.springframework.beans.factory.annotation.Autowired; |
85 | 86 | import org.springframework.beans.factory.annotation.Qualifier;
|
86 | 87 | import org.springframework.beans.factory.annotation.Value;
|
87 | 88 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
88 | 89 | import org.springframework.context.annotation.Bean;
|
89 | 90 | import org.springframework.context.annotation.Configuration;
|
90 | 91 | import org.springframework.context.annotation.DependsOn;
|
| 92 | +import org.springframework.context.annotation.Lazy; |
91 | 93 | import org.springframework.core.io.ClassPathResource;
|
92 | 94 | import org.springframework.util.StringUtils;
|
93 | 95 | import reactor.core.publisher.Flux;
|
94 | 96 | import reactor.core.publisher.Mono;
|
95 | 97 | import reactor.util.function.Tuple2;
|
96 | 98 | import reactor.util.function.Tuples;
|
97 | 99 |
|
| 100 | +/** |
| 101 | + * Default configuration class for ALL integration tests. |
| 102 | + * <p> |
| 103 | + * Some beans are annotated as {@link Lazy}, meaning that they will only be initialized |
| 104 | + * if a test class actually uses them through {@link Autowired} injection. This allows us |
| 105 | + * to declare some CF applications as beans, but only push them when they are actually |
| 106 | + * used by the class under tests. This makes our tests faster, as pushing an app can take |
| 107 | + * several minutes. |
| 108 | + */ |
98 | 109 | @Configuration
|
99 | 110 | @EnableAutoConfiguration
|
100 | 111 | public class IntegrationTestConfiguration {
|
@@ -460,6 +471,7 @@ Version serverVersion(@Qualifier("admin") CloudFoundryClient cloudFoundryClient)
|
460 | 471 | .block();
|
461 | 472 | }
|
462 | 473 |
|
| 474 | + @Lazy |
463 | 475 | @Bean(initMethod = "block")
|
464 | 476 | @DependsOn("cloudFoundryCleaner")
|
465 | 477 | Mono<String> serviceBrokerId(
|
@@ -572,6 +584,7 @@ Mono<String> stackName(CloudFoundryClient cloudFoundryClient) {
|
572 | 584 | .cache();
|
573 | 585 | }
|
574 | 586 |
|
| 587 | + @Lazy |
575 | 588 | @Bean(initMethod = "block")
|
576 | 589 | @DependsOn("cloudFoundryCleaner")
|
577 | 590 | Mono<ApplicationUtils.ApplicationMetadata> testLogCacheApp(
|
@@ -608,6 +621,7 @@ String testLogCacheAppName(NameFactory nameFactory) {
|
608 | 621 | return nameFactory.getApplicationName();
|
609 | 622 | }
|
610 | 623 |
|
| 624 | + @Lazy |
611 | 625 | @Bean
|
612 | 626 | TestLogCacheEndpoints testLogCacheEndpoints(
|
613 | 627 | ConnectionContext connectionContext,
|
|
0 commit comments