Annotation Interface EnableNatsServer


@Retention(RUNTIME) @Target(TYPE) @Documented @Inherited public @interface EnableNatsServer
Annotation that can be specified on a test class that runs Nats based tests. Provides the following features over and above the regular Spring TestContext Framework:

The typical usage of this annotation is like:

 @SpringBootTest
 @EnableNatsServer
 public class MyNatsTests {

    @Autowired
    private NatsServer natsServer;

 }
 
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    File to nats server binary so no download will be needed
    Passes the original parameters to NatsServer#config(String...) for startup NatsConfig
    Config file
    Custom download URL
    int
    Sets nats port -1 means random port
    long
    Defines the startup and teardown timeout
    Sets the version for the NatsServer
  • Element Details

    • port

      int port
      Sets nats port -1 means random port
      Default:
      4222
    • timeoutMs

      long timeoutMs
      Defines the startup and teardown timeout
      Default:
      10000L
    • configFile

      String configFile
      Config file
      Default:
      ""
    • downloadUrl

      String downloadUrl
      Custom download URL
      Default:
      ""
    • binaryFile

      String binaryFile
      File to nats server binary so no download will be needed
      Default:
      ""
    • config

      String[] config
      Passes the original parameters to NatsServer#config(String...) for startup NatsConfig
      Default:
      {}
    • version

      String version
      Sets the version for the NatsServer
      Default:
      ""