Created
May 17, 2011 03:53
-
-
Save peteroyle/975911 to your computer and use it in GitHub Desktop.
Injecting Precompiled Reports using @resource
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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