Skip to content

Instantly share code, notes, and snippets.

@peteroyle
Created May 17, 2011 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peteroyle/975911 to your computer and use it in GitHub Desktop.
Save peteroyle/975911 to your computer and use it in GitHub Desktop.
Injecting Precompiled Reports using @resource
@Produces @JasperReports @Resource
public Report precompileJasperReport(InjectionPoint ip) {
JasperSeamReportLoader loader = new JasperSeamReportLoader();
Report report = null;
for (Annotation ant : ip.getQualifiers().iterator()) {
if (ant is a @Resource) {
Resource r = (Resource)ant;
InputStream is = getClassloader().getResourceAsStream(r.value());
report = loader.compile(is);
}
}
return report;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment