类 ContainerConnectionDetailsFactory<C extends org.testcontainers.containers.Container<?>,D extends ConnectionDetails>
java.lang.Object
org.springframework.boot.testcontainers.service.connection.ContainerConnectionDetailsFactory<C,D>
- 类型参数:
C- the container typeD- the connection details type
- 所有已实现的接口:
ConnectionDetailsFactory<ContainerConnectionSource<C>,D>
public abstract class ContainerConnectionDetailsFactory<C extends org.testcontainers.containers.Container<?>,D extends ConnectionDetails>
extends Object
implements ConnectionDetailsFactory<ContainerConnectionSource<C>,D>
Base class for
ConnectionDetailsFactory implementations that provide
ConnectionDetails from a ContainerConnectionSource.- 从以下版本开始:
- 3.1.0
- 作者:
- Moritz Halbritter, Andy Wilkinson, Phillip Webb
-
嵌套类概要
嵌套类修饰符和类型类说明protected static classContainerConnectionDetailsFactory.ContainerConnectionDetails<C extends org.testcontainers.containers.Container<?>>Base class forConnectionDetailsresults that are backed by aContainerConnectionSource. -
字段概要
字段修饰符和类型字段说明protected static final StringConstant passed to the constructor when any connection name is accepted. -
构造器概要
构造器限定符构造器说明protectedCreate a newContainerConnectionDetailsFactoryinstance that acceptsany connection name.protectedContainerConnectionDetailsFactory(String connectionName, String... requiredClassNames) Create a newContainerConnectionDetailsFactoryinstance with the given connection name restriction.protectedContainerConnectionDetailsFactory(List<String> connectionNames, String... requiredClassNames) Create a newContainerConnectionDetailsFactoryinstance with the given supported connection names. -
方法概要
修饰符和类型方法说明final DGet theConnectionDetailsfrom the givensource.protected abstract Dprotected booleansourceAccepts(ContainerConnectionSource<C> source, Class<?> requiredContainerType, Class<?> requiredConnectionDetailsType) Return if the given source accepts the connection.
-
字段详细资料
-
ANY_CONNECTION_NAME
Constant passed to the constructor when any connection name is accepted.
-
-
构造器详细资料
-
ContainerConnectionDetailsFactory
protected ContainerConnectionDetailsFactory()Create a newContainerConnectionDetailsFactoryinstance that acceptsany connection name. -
ContainerConnectionDetailsFactory
Create a newContainerConnectionDetailsFactoryinstance with the given connection name restriction.- 参数:
connectionName- the required connection name orANY_CONNECTION_NAMErequiredClassNames- the names of classes that must be present
-
ContainerConnectionDetailsFactory
protected ContainerConnectionDetailsFactory(List<String> connectionNames, String... requiredClassNames) Create a newContainerConnectionDetailsFactoryinstance with the given supported connection names.- 参数:
connectionNames- the supported connection namesrequiredClassNames- the names of classes that must be present- 从以下版本开始:
- 3.4.0
-
-
方法详细资料
-
getConnectionDetails
从接口复制的说明:ConnectionDetailsFactory- 指定者:
getConnectionDetails在接口中ConnectionDetailsFactory<C extends org.testcontainers.containers.Container<?>,D extends ConnectionDetails> - 参数:
source- the source- 返回:
- the connection details or
null
-
sourceAccepts
protected boolean sourceAccepts(ContainerConnectionSource<C> source, Class<?> requiredContainerType, Class<?> requiredConnectionDetailsType) Return if the given source accepts the connection. By default this method checks each connection name.- 参数:
source- the container connection sourcerequiredContainerType- the required container typerequiredConnectionDetailsType- the required connection details type- 返回:
- if the source accepts the connection
- 从以下版本开始:
- 3.4.0
-
getContainerConnectionDetails
Get theConnectionDetailsfrom the givenContainerConnectionSourcesource. May returnnullif no connection can be created. Result types should consider extendingContainerConnectionDetailsFactory.ContainerConnectionDetails.- 参数:
source- the source- 返回:
- the service connection or
null.
-