A lightweight, annotationādriven Mediator pattern implementation for Spring Boot that decouples request objects from their handlers and centralizes the dispatch logic.
-
Annotation-based configuration: Enable the mediator with a single annotation.
-
Generic request/response support: Send commands and queries with typed responses.
-
Automatic handler registration: All your RequestHandler beans are discovered and wired up.
-
Spring Boot starterāstyle integration: Plug into any existing Spring Boot app.
<dependency>
<groupId>com.mehmetsolak</groupId>
<artifactId>spring-boot-mediator</artifactId>
<version>1.0.0</version>
</dependency>
implementation 'com.mehmetsolak:spring-boot-mediator:1.0.0'
Add @EnableMediator
to your main Spring Boot application class:
Create a class that implements your Request<TResponse>
interface. For example, a CarCreateCommand that returns a CarResponse:
Implement RequestHandler<CommandType, ResponseType>
and annotate it as a Spring bean:
Inject Mediator into your controller and send()
your command:
Contributions are welcome! Feel free to open issues or submit pull requests for improvements.
For questions or suggestions, please open an issue or contact the maintainer.
- Email: solakmehmet02@gmail.com
- Github: Github
- LinkedIn: Mehmet Solak