Use beanName as default name of @ServiceConnection#36064
Conversation
What about bean name as |
|
IIRC, this was introduced in order to make sure the ConnectionFactory to be used. This is due there is no specific Testcontainers implementation. Redis and Zipkin fall into this because both use GenericContainer but the issue comes with custom images ("my-custom-kv-store") which will always requires |
|
If people migrate @ServiceConnection
GenericContainer<?> redis = return new GenericContainer<>("redis").withExposedPorts(6379);to @Bean
@ServiceConnection
GenericContainer<?> redis() {
return new GenericContainer<>("redis").withExposedPorts(6379);
}They will encounter unexpected |
|
That's not because the field is called
When you're using |
I know that because I read sources before preparing this PR, but most people doesn't read sources even documents, they want intuitional programming experience. |
|
Using beanName as default name of |
Before this commit, ConnectionDetailsNotFoundException will be raised if unnamed @Serviceconnection is annotated on @bean method and containerType is not accepted by ContainerConnectionSource.
Before this commit,
ConnectionDetailsNotFoundExceptionwill be raised if unnamed@ServiceConnectionis annotated on@Beanmethod andcontainerTypeis not accepted byContainerConnectionSource.For example:
After this commit, name of
@ServiceConnectioncould be omitted.