Skip to content

Instantly share code, notes, and snippets.

@jhiemer
Created May 4, 2012 09:46
Show Gist options
  • Save jhiemer/2593664 to your computer and use it in GitHub Desktop.
Save jhiemer/2593664 to your computer and use it in GitHub Desktop.
UUIDConverter plugged..
/**
* Either the user's pre-configured {@link ConversionService} or the
* {@link DefaultConversionService}.
*
* @return
*/
@Bean
ConversionService conversionService() {
if (null != customConversionService) {
return customConversionService;
} else {
defaultConversionService.addConverter(new StringToUUIDConverter());
return defaultConversionService;
}
}
public class StringToUUIDConverter implements Converter<String, UUID> {
public UUID convert(String source) {
if (source != null)
return UUID.fromString(source);
else
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment