Closed eximius313 closed 5 years ago
PdfGenerator uses filed injection:
PdfGenerator
@Inject Environment environment; public PdfGenerator() { }
therefore there is no possibility to configure it at all, because if you do:
public class ApplicationModule extends AbstractModule { @Override protected void configure() { bind(PdfGenerator.class).toProvider(PdfGeneratorProvider.class).asEagerSingleton(); } static class PdfGeneratorProvider implements Provider<PdfGenerator> { private final PdfGenerator pdfGenerator; public PdfGeneratorProvider() { this.pdfGenerator = new PdfGenerator(); this.pdfGenerator.loadLocalFonts(asList("fonts/opensans-regular.ttf")); } @Override public PdfGenerator get() { return pdfGenerator; } } }
then you end up in NullPointerException (because environment is null!)
If you just change it to construction injection:
final Environment environment; @Inject public PdfGenerator(final Environment environment) { this.environment = environment; }
then everything works and is backward compatibile
Hi, I had a problem with Nexus , the release is 1.8.2.
Allright! I'll check it today evening and provide PR for 1.9.x
here it is: https://github.com/innoveit/play2-pdf/pull/36
PdfGenerator
uses filed injection:therefore there is no possibility to configure it at all, because if you do:
then you end up in NullPointerException (because environment is null!)
If you just change it to construction injection:
then everything works and is backward compatibile