Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autowire Converters in WebMVC #102

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Conversation

GODrums
Copy link
Collaborator

@GODrums GODrums commented Sep 23, 2024

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

  • PR title is clear and descriptive
  • PR description explains the purpose and changes
  • Code follows project coding standards
  • Self-review of the code has been done
  • Changes have been tested locally
  • Screenshots have been attached (if applicable)
  • Documentation has been updated (if applicable)

Server (if applicable)

  • Code is performant and follows best practices
  • No security vulnerabilities introduced
  • Proper error handling has been implemented
  • Added tests for new functionality
  • Changes have been tested in different environments (if applicable)

@GODrums GODrums added enhancement New feature or request application-server labels Sep 23, 2024
@GODrums GODrums added this to the Initial Project Setup milestone Sep 23, 2024
@GODrums GODrums self-assigned this Sep 23, 2024
@github-actions github-actions bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 23, 2024
Copy link
Contributor

@iam-flo iam-flo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@GODrums
Copy link
Collaborator Author

GODrums commented Sep 23, 2024

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.

Copy link
Collaborator

@FelixTJDietrich FelixTJDietrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, i think it is fine like this for now. I guess we will have some more converters in the future for GitLab etc. but we can just add them here manually for now 👍

@FelixTJDietrich FelixTJDietrich merged commit 7b9c90c into develop Sep 25, 2024
6 checks passed
@FelixTJDietrich FelixTJDietrich deleted the improve-conversion-logic branch September 25, 2024 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application-server enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants