Skip to content

Instantly share code, notes, and snippets.

@sirech
Created June 16, 2019 16:18
Show Gist options
  • Save sirech/9160dea80b1a555446e27b51f70e9660 to your computer and use it in GitHub Desktop.
Save sirech/9160dea80b1a555446e27b51f70e9660 to your computer and use it in GitHub Desktop.
@Configuration
class ConverterConfiguration : WebMvcConfigurer {
override fun addFormatters(registry: FormatterRegistry) {
registry.addConverter(userId())
}
private fun userId(): Converter<String, UserId> {
return Converter<String, UserId> { source -> UserId.create(source) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment