Class AsyncApiController
java.lang.Object
be.appify.prefab.asyncapi.AsyncApiController
REST controller that exposes AsyncAPI documentation endpoints.
GET /async-api/asyncapi.json— the machine-readable AsyncAPI 2.6.0 documentGET /async-api— a human-readable HTML viewer backed by AsyncAPI Studio
The JSON document is generated at compile time by the Prefab annotation processor and
embedded in the application JAR at META-INF/async-api/asyncapi.json.
Spring property placeholders (e.g. ${topics.orders}) used as topic names in
@Event annotations are resolved at runtime against the application Environment.
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncApiController(org.springframework.core.env.Environment environment) Constructs a new AsyncApiController. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<String> Returns the machine-readable AsyncAPI 2.6.0 JSON document with all Spring property placeholders in channel names resolved against the application environment.
-
Constructor Details
-
AsyncApiController
public AsyncApiController(org.springframework.core.env.Environment environment) Constructs a new AsyncApiController.- Parameters:
environment- the Spring environment used to resolve property placeholders in topic names
-
-
Method Details
-
asyncApiJson
@GetMapping(value="/asyncapi.json", produces="application/json") public org.springframework.http.ResponseEntity<String> asyncApiJson() throws IOExceptionReturns the machine-readable AsyncAPI 2.6.0 JSON document with all Spring property placeholders in channel names resolved against the application environment.- Returns:
- the AsyncAPI JSON document, or
404if the file was not generated, or500if a placeholder cannot be resolved - Throws:
IOException- if the document cannot be read from the classpath
-