Skip to main content

Configuration

Add the following to the spring application.properties file:

# Springwolf - required fields
springwolf.docket.base-package=io.github.springwolf.example
springwolf.docket.info.title=${spring.application.name}
springwolf.docket.info.version=1.0.0

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

# Springwolf - optional fields
springwolf.enabled=true
springwolf.docket.default-content-type=application/json
springwolf.docket.id=urn:io:github:springwolf:example
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.info.x-internal-id=xyz-123

# Springwolf - debugging
logging.level.io.github.springwolf=DEBUG

Properties

base-backage (required)

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

The base-package will be scanned for classes containing @Component annotated classes (that includes @Service annotated classes) for methods annotated with @JmsListener, @KafkaListener, @RabbitListener, @SqsListener, @AsyncListener, @AsyncPublisher, etc. @Configuration classes are scanned for @Bean containing the previously mentioned annotations as well.

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.

Servers (required)

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

An AsyncAPI document can contain more than one server, but it's 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.

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

The default is application/json and it has an effect on the payload example generation. Also supported: text/xml, application/yaml.

Extension Fields

The AsyncAPI specification allows the definition of additional data fields to extend the specification at certain points (see Specification Extensions ).

Extension Fields may be added to Info, Contact, License and Server objects both via application.properties. Every custom extension field must begin with x-, for example x-internal-id (see sample configurations above).

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.init-modefail_fastSpringwolf initializes during start up with fail_fast or in the background after the application has started.
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.endpoint.actuator.enabledfalsePublish the AsyncAPI document as part of Spring Boot’s actuator feature.
springwolf.use-fqntrueUse fully qualified names for the schema classes. Required for publishing
springwolf.payload.extractable-classes..N/AExtract additional payload types. See message payloads for more details.
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.
JMS
springwolf.plugin.jms.publishing.enabledfalseAllow (anyone) to produce JMS messages from the UI. Note that this has security implications
springwolf.plugin.jms.scanner.jms-listener.enabledtrueEnable scanner to find methods annotated with @JmsListener.
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. SpringwolfKafkaProducer demonstrates multiple producer configuration to publish to Avro and Protobuf.
springwolf.plugin.kafka.scanner.kafka-listener.enabledtrueEnable scanner to find methods annotated with @KafkaListener.
SNS
springwolf.plugin.sns.publishing.enabledfalseAllow (anyone) to produce SNS messages from the UI. Note that this has security implications
SQS
springwolf.plugin.sqs.publishing.enabledfalseAllow (anyone) to produce SQS messages from the UI. Note that this has security implications
springwolf.plugin.sqs.scanner.sqs-listener.enabledtrueEnable scanner to find methods annotated with @SqsListener.

Actuator support

Springwolf supports exposing the AsyncAPI document as part of Spring Boot’s actuator endpoint. The AsyncAPI document will then be moved underneath actuators base path, that's /actuator/springwolf/docs.json or /actuator/springwolf/docs.yaml respectively.

To enable it, add the spring-boot-actuator dependency first. Second, enable the actuator endpoint in the application.properties file:

# Move Springwolf endpoint to actuator
springwolf.endpoint.actuator.enabled=true

# Expose Springwolf endpoint in spring
management.endpoints.web.exposure.include=springwolf

If the actuator management port is configured differently than the application port or the actuator base path is changed, then the exposed AsyncAPI document will follow accordingly.

note

Enabling actuator support for Springwolf will break the Springwolf UI.