code: @Override
      protected FreeMarkerConfig autodetectConfiguration() throws BeansException {
          SiteContext siteContext = SiteContext.getCurrent();
          if (siteContext != null) {
              return siteContext.getFreeMarkerConfig();
          } else {
              return super.autodetectConfiguration();
          }
      }
docs: Instead of returning the same bean from the application context, a {@link FreeMarkerConfig} is returned for
  the current {@link SiteContext}.