class FreeMarkerPlugin {

    private static final AgentLogger LOGGER = AgentLogger.getLogger(FreeMarkerPlugin.class);

    @Init
    private Scheduler scheduler;

    private final Command clearIntrospectionCache = new Command() {
        @Override
        public void executeCommand() {<FILL_FUNCTION_BODY>}
    };

    private Object freeMarkerServlet;

    @OnClassLoadEvent(classNameRegexp = "freemarker.ext.servlet.FreemarkerServlet")
    public static void init(ClassPool classPool, final CtClass ctClass) throws NotFoundException, CannotCompileException {

        String src = PluginManagerInvoker.buildInitializePlugin(FreeMarkerPlugin.class);
        src += PluginManagerInvoker.buildCallPluginMethod(FreeMarkerPlugin.class,
                "registerServlet", "this", "java.lang.Object");
        CtMethod init = ctClass.getDeclaredMethod("init");
        init.insertAfter(src);

        LOGGER.debug("Patched freemarker.ext.servlet.FreemarkerServlet");
    }

    public void registerServlet(final Object freeMarkerServlet) {
        this.freeMarkerServlet = freeMarkerServlet;
        LOGGER.info("Plugin {} initialized for servlet {}", getClass(), this.freeMarkerServlet);
    }

    @OnClassLoadEvent(classNameRegexp = ".*", events = {LoadEvent.REDEFINE})
    public void cacheReloader(CtClass ctClass) {
        scheduler.scheduleCommand(clearIntrospectionCache, 500);
    }

    @OnClassLoadEvent(classNameRegexp = "org.springframework.ui.freemarker.FreeMarkerConfigurationFactory")
    public static void patchCreateConfiguration(ClassPool classPool, final CtClass ctClass) {
        try {
            CtMethod method = ctClass.getDeclaredMethod("createConfiguration", new CtClass[]{});
            method.insertBefore("this.preferFileSystemAccess = false;");
            method.insertBefore("String[] $ha$newArray = new String[this.templateLoaderPaths.length + 1]; " +
                    "$ha$newArray[0] = \"classpath:/$ha$freemarker\";" +
                    "for (int i = 0; i < this.templateLoaderPaths.length; i++) {" +
                    "    $ha$newArray[i + 1] = this.templateLoaderPaths[i];" +
                    "}" + "this.templateLoaderPaths = $ha$newArray;");
        } catch (NotFoundException | CannotCompileException e) {
            LOGGER.debug("Cannot patch patchCreateConfiguration method for {}", ctClass.getName(), e);
        }
    }

    @OnClassLoadEvent(classNameRegexp = "freemarker.template.Configuration")
    public static void patchCreateTemplateCache(ClassPool classPool, final CtClass ctClass) {
        try {
            CtMethod method = ctClass.getDeclaredMethod("createTemplateCache", new CtClass[]{});
            method.insertAfter("cache.setDelay(0L);");
        } catch (NotFoundException | CannotCompileException e) {
            LOGGER.debug("Cannot patch patchCreateTemplateCache method for {}", ctClass.getName(), e);
        }
    }
}

            LOGGER.debug("Clearing FreeMarker BeanWrapper class introspection class.");
            try {
                Object config = ReflectionHelper.get(freeMarkerServlet, "config");
                Object objectWrapper = ReflectionHelper.get(config, "objectWrapper");
                ReflectionHelper.invoke(objectWrapper, objectWrapper.getClass(), "clearClassIntrospecitonCache", new Class[]{});
                LOGGER.info("Cleared FreeMarker introspection cache");
            } catch (Exception e) {
                LOGGER.error("Error clearing FreeMarker introspection cache", e);
            }
        
<no_super_class>