@Override
protected void doInit(ClassLoader loader) {
ClassLoader previous = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(loader);
DefaultMustacheFactory factory = new DefaultMustacheFactory(resourceRoot) {
@Override
public MustacheVisitor createMustacheVisitor() {
return new DefaultMustacheVisitor(this) {
@Override
public void pragma(TemplateContext templateContext, String pragma, String args) {
if ("param".equals(pragma)) {
// Do nothing
} else {
super.pragma(templateContext, pragma, args);
}
}
};
}
};
mustache = factory.compile(mustacheName);
}
finally {
Thread.currentThread().setContextClassLoader(previous);
}
}