Skip to main content

Configuration

There are 2 ways to configure springwolf:

  1. application.properties, which is simple and should suit most use-cases
  2. AsyncApiDocket, which allows adding producers and consumers via code (and avoiding annotations)
Add the following to the spring application.properties file.
springwolf.docket.base-package=io.github.stavshamir.springwolf.example
springwolf.docket.id=urn:io:github:stavshamir:springwolf:example
springwolf.docket.default-content-type=application/json

springwolf.docket.info.title=${spring.application.name}
springwolf.docket.info.version=1.0.0
springwolf.docket.info.description=Springwolf example project to demonstrate springwolfs abilities
springwolf.docket.info.terms-of-service=http://asyncapi.org/terms
springwolf.docket.info.contact.name=springwolf
springwolf.docket.info.contact.email=example@example.com
springwolf.docket.info.contact.url=https://github.com/springwolf/springwolf-core
springwolf.docket.info.license.name=Apache License 2.0

springwolf.docket.servers.kafka.protocol=kafka
springwolf.docket.servers.kafka.url=${spring.kafka.bootstrap-servers}

Properties

basePackage (required)

It is recommended to structure the project such that all consumers and producers (classes containing listener/producer methods) are in the same package - it is not mandatory, and if they are scattered across multiple packages, just provide the highest in hierarchy package that contains all of them.

The base package will be scanned for classes containing @Component annotated classes (that includes @Service annotated classes) for methods annotated with @KafkaListener, @RabbitListener, @AsyncListener, @AsyncPublisher, etc.

id

The Identifier value represents a unique universal identifier of the application. See Identifier.

default-content-type

A string representing the default content type to use when encoding/decoding a message's payload. See Default Content Type

Info (required)

The Info object provides metadata about the API (see Info Object).

All provided fields will be present in the generated document, but not all will be displayed in the UI.

Server

The Server object provides metadata the can help the reader understand the protocol, version, login details and more (see Server Object).

An AsyncAPI document can contain more than one server, but it is not common.

As with the Info object, all provided fields will be present in the generated document, but not all will be displayed in the UI.

Additional application.properties

The following table contains additional properties that can be specified in the application.properties file:

Property NameDefault ValueDescription
springwolf.enabledtrueAllows to enable/disable springwolf at one central place.
springwolf.paths.docs/springwolf/docsThe path of the AsyncAPI document in JSON format. Note that at the moment the UI will work only with the default value.
springwolf.scanner.consumer-data.enabledtrueEnable scanner to find consumers defined in AsyncApiDocket.
springwolf.scanner.producer-data.enabledtrueEnable scanner to find producers defined in AsyncApiDocket.
springwolf.scanner.async-listener.enabledtrueEnable scanner to find methods annotated with @AsyncListener.
springwolf.scanner.async-publisher.enabledtrueEnable scanner to find methods annotated with @AsyncPublisher.
AMQP
springwolf.plugin.amqp.publishing.enabledfalseAllow (anyone) to produce amqp messages from the UI. Note that this has security implications
springwolf.plugin.amqp.scanner.rabbit-listener.enabledtrueEnable scanner to find methods annotated with @RabbitListener.
Kafka
springwolf.plugin.kafka.publishing.enabledfalseAllow (anyone) to produce kafka messages from the UI. Note that this has security implications
springwolf.plugin.kafka.publishing.producernullConfigure the kafka producer used to publish messages from the UI. Uses identical parameters as spring.kafka.producer
springwolf.plugin.kafka.scanner.kafka-listener.enabledtrueEnable scanner to find methods annotated with @KafkaListener.