While migrating to Spring Boot 2.2 (Spring Cloud Hoxton.RC2 & Spring Cloud Netflix 2.2.0.RC2) I've been experimenting with the new spring.main.lazy-initialization property and I think I've discovered a bug. When lazy initialization is enabled, ribbon no longer properly loads a client's listOfServers property. I'm thinking this is an issue relating to how Archaius loads the configuration.
This sample test demonstrates what occurs:
@ExtendWith(SpringExtension.class)
@SpringBootTest(
classes = App.class,
properties = {"client.ribbon.listOfServers=google.com", "spring.main.lazy-initialization=true"})
public class FeignLazyInitTest {
@Autowired
private LoadBalancerClient client;
@Test
void test() {
System.out.println("Getting instance of client");
assertThat(client.choose("client")).isNotNull();
}
@SpringBootApplication
public static class App {
public static void main(String[] args) {
SpringApplication.run(LimaAgentQueueApplication.class, args);
}
}
}
When lazy initialization is enabled the test fails because the result is null. When it is disabled, the test passes.
Comment From: OlgaMaciaszek
Hi @tvrmsmith Thanks. Was able to reproduce the issue.