code: @Bean
    public FreeMarkerConfigurer freeMarkerConfigurer() {
      FreeMarkerConfigurer result =
          new FreeMarkerConfigurer() {
            @Override
            protected void postProcessConfiguration(Configuration config) {
              config.setObjectWrapper(new MolgenisFreemarkerObjectWrapper(VERSION_2_3_23));
            }
  
            @Override
            protected void postProcessTemplateLoaders(List<TemplateLoader> templateLoaders) {
              templateLoaders.add(new ClassTemplateLoader(FreeMarkerConfigurer.class, ""));
            }
          };
      result.setPreferFileSystemAccess(false);
      result.setTemplateLoaderPath("classpath:/templates/");
      result.setDefaultEncoding("UTF-8");
      Properties freemarkerSettings = new Properties();
      freemarkerSettings.setProperty(Configuration.LOCALIZED_LOOKUP_KEY, Boolean.FALSE.toString());
      freemarkerSettings.setProperty(Configuration.NUMBER_FORMAT_KEY, "computer");
      result.setFreemarkerSettings(freemarkerSettings);
      Map<String, Object> freemarkerVariables = Maps.newHashMap();
      freemarkerVariables.put("hasPermission", new HasPermissionDirective(permissionService));
      freemarkerVariables.put("notHasPermission", new NotHasPermissionDirective(permissionService));
      addFreemarkerVariables(freemarkerVariables);
  
      result.setFreemarkerVariables(freemarkerVariables);
  
      return result;
    }
docs: Configure freemarker. All freemarker templates should be on the classpath in a package called
  'freemarker'