Creating Decorators with Mapstruct in a Spring Boot Application
The article discusses how to create a decorator with Mapstruct in a Spring Boot application. The author explains that they have a Spring Boot application with auto component scan enabled and Mapstruct set up correctly for basic mappings created on interfaces. However, they are facing difficulties in adding a custom decorator to it. The author provides an example of their older solution where they manually created a bean for all the mappers they had. They now want to extract the extra logic defined in their mapper interfaces into a decorator class. However, the decorator is not generated into the mapper implementation and the code is never called. The author has tried various solutions, including using the @Component annotation on the decorator, but it did not make a difference. The article concludes with the author seeking help and advice on why the decorator does not work. This article is relevant for developers using Mapstruct in their Spring Boot applications and looking to implement decorators for their mappings.