Default factory for stubs when scanning as documented

Also add failing test. Fixes #172.
This commit is contained in:
Dave Syer
2025-05-15 17:43:43 +01:00
parent bd70fcd69f
commit 7de96df5bd
2 changed files with 31 additions and 2 deletions

View File

@@ -79,4 +79,29 @@ public class GrpcClientApplicationTests {
}
@Nested
@SpringBootTest
@AutoConfigureInProcessTransport
class ExplicitImportClientsWithNoFactory {
@Autowired
private ApplicationContext context;
@Test
void stubOfCorrectTypeIsCreated() {
assertThat(context.containsBeanDefinition("simpleBlockingStub")).isTrue();
assertThat(context.getBean(SimpleGrpc.SimpleBlockingStub.class)).isNotNull();
assertThat(context.containsBeanDefinition("simpleStub")).isFalse();
assertThat(context.containsBeanDefinition("simpleFutureStub")).isFalse();
assertThat(context.getBeanNamesForType(AbstractStub.class)).hasSize(1);
}
@TestConfiguration
@ImportGrpcClients
static class TestConfig {
}
}
}