Annotation Interface Client


@Documented @Retention(RUNTIME) @Introduction @Singleton public @interface Client
Allows defining declarative HTTP clients and customizing injection for injecting HttpClient implementations.
Since:
1.0
  • Element Details

    • value

      @AliasFor(member="id") String value
      Returns:
      The URL or service ID of the remote service
      Default:
      ""
    • id

      @AliasFor(member="value") String id
      Returns:
      The ID of the client
      Default:
      ""
    • path

      String path
      The base URI for the client. Only to be used in conjunction with id().
      Returns:
      The base URI
      Default:
      ""
    • errorType

      Class<?> errorType
      Returns:
      The type used to decode errors
      Default:
      io.micronaut.http.hateoas.JsonError.class
    • configuration

      Class<? extends HttpClientConfiguration> configuration
      Returns:
      The http client configuration bean to use
      Default:
      io.micronaut.http.client.HttpClientConfiguration.class
    • httpVersion

      @Deprecated io.micronaut.http.HttpVersion httpVersion
      Deprecated.
      There are now separate settings for HTTP and HTTPS connections. To configure HTTP connections (e.g. for h2c), use plaintextMode(). To configure ALPN, set alpnModes().
      The HTTP version.
      Returns:
      The HTTP version of the client.
      Default:
      HTTP_1_1
    • plaintextMode

      @NonNull HttpVersionSelection.PlaintextMode plaintextMode
      The connection mode to use for plaintext (http as opposed to https) connections.
      Note: If httpVersion() is set, this setting is ignored!
      Returns:
      The plaintext connection mode.
      Since:
      4.0.0
      Default:
      HTTP_1
    • alpnModes

      @NonNull @NonNull String[] alpnModes
      The protocols to support for TLS ALPN. If HTTP 2 is included, this will also restrict the TLS cipher suites to those supported by the HTTP 2 standard.
      Note: If httpVersion() is set, this setting is ignored!
      Returns:
      The supported ALPN protocols.
      Since:
      4.0.0
      Default:
      {"h2", "http/1.1"}