Map<String,SimpleDateFormat> dateFormatCache = new HashMap<String,SimpleDateFormat>();
@Produces
@DateFormat
public SimpleDateFormat getDateFormat(InjectionPoint ip){
DateFormat df = ip.getAnnotated().getAnnotation(DateFormat.class);
String pattern = df.pattern();
if(dateFormatCache.containsKey(pattern)){
return dateFormatCache.get(pattern);
}
SimpleDateFormat sdf = new SimpleDateFormat(df.pattern());
dateFormatCache.put(pattern,sdf);
return sdf;
}