Annotation Interface ServiceConnection


@Retention(RUNTIME) @Target({FIELD,METHOD,ANNOTATION_TYPE}) public @interface ServiceConnection
Annotation used to indicate that a field or method is a ContainerConnectionSource which provides a service that can be connected to.
Since:
3.1.0
Author:
Moritz Halbritter, Andy Wilkinson, Phillip Webb
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The name of the service being connected to.
    A restriction to types of ConnectionDetails that can be created from this connection.
    The name of the service being connected to.
  • Element Details

    • value

      @AliasFor("name") String value
      The name of the service being connected to. Container names are used to determine the connection details that should be created when a technology-specific Container subclass is not available.

      If not specified, and if the Container instance is available, the repository part of the docker image name will be used. Note that Container instances are not available early enough when the container is defined as a @Bean method. All @ServiceConnection @Bean methods that need to match on the connection name must declare this attribute.

      This attribute is an alias for name().

      Returns:
      the name of the service
      See Also:
      Default:
      ""
    • name

      @AliasFor("value") String name
      The name of the service being connected to. If not specified, the image name will The name of the service being connected to. Container names are used to determine the connection details that should be created when a technology-specific Container subclass is not available.

      If not specified, and if the Container instance is available, the repository part of the docker image name will be used. Note that Container instances are not available early enough when the container is defined as a @Bean method. All @ServiceConnection @Bean methods that need to match on the connection name must declare this attribute.

      This attribute is an alias for value().

      Returns:
      the name of the service
      See Also:
      Default:
      ""
    • type

      Class<? extends ConnectionDetails>[] type
      A restriction to types of ConnectionDetails that can be created from this connection. The default value does not restrict the types that can be created.
      Returns:
      the connection detail types that can be created to establish the connection
      Default:
      {}