ls1intum / Hephaestus

Hephaestus - A Generative AI Mentor for Agile Software Development
MIT License
7 stars 1 forks source link

Autowire Converters in WebMVC #102

Closed GODrums closed 1 week ago

GODrums commented 1 week ago

Motivation

Seperating the server logic across dedicated files often helps keep files clean and understandable. Our type converters can easily be handled by Spring itself, making manual handling obsolete.

Description

This PR adds all our type converters to a dedicated WebMvcConfigurer making it possible to be autowired whenever necessary. This cleans up a lot of boilerplate code of our GitHubDataSyncService-constructor, letting Spring handle the injection. Source: https://www.baeldung.com/spring-type-conversions#creating-a-custom-converter

Checklist

General

Server (if applicable)

GODrums commented 1 week ago

At some point we could probably think about using https://github.com/ronmamo/reflections to automatically detect these kinds of classes to generalize these configuration classes, also applying to ClassImportIntegratorIntegratorProvider. @FelixTJDietrich, let me know if this is something you are interested in and I could integrate it into this PR already.