The Convention Is the Wiring
You already trust conventions to wire your Spring Boot application. What happens when the same idea reaches the infrastructure? Part 1: Convention Over Configuration, Spring Boot Style In Spring Boot, where you place your main class determines what the application discovers, because @SpringBootApplication scans that package and everything below it . The same principle runs deeper.…
The article discusses the concept of "Convention Over Configuration" in the context of Spring Boot and its application to infrastructure in cloud services like AWS. The core idea is that if something can be derived, why declare it manually?
In Spring Boot, placing your main class in a specific package allows the framework to automatically scan that package and its sub-packages, deriving various aspects of the application. Similarly, configuration files like application.yaml enable similar auto-configuration.
The author then draws parallels to AWS infrastructure, which still requires manual setup for elements like queue management, retries, routing, permissions, and mappings. The transition from application-specific wiring to infrastructure configuration is complex and can lead to a split between developer-defined events and infrastructure details.
The article introduces Poja as a tool that simplifies this process. By following certain conventions in your code, Poja automatically handles the infrastructure setup for asynchronous processing. Developers only need to extend a base class (PojaEvent), declare the maximum duration for the consumer and retries, and place these classes in designated packages. Poja then derives the consumer class name from the event's fully-qualified name and calculates the SQS visibility timeout.
This approach streamlines the wiring process, reducing manual configuration and potential errors. However, it requires adherence to specific naming conventions, as any misnaming can lead to runtime issues. While Poja handles much of the infrastructure setup, developers still need to configure resources outside Poja's scope.
The article concludes by encouraging readers to try this approach with their own code, deploying a simple event and observing the infrastructure elements generated by Poja, such as the queue, routing rules, and visibility timeout.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.