package com.yvan.freemarker;

import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

@Configuration
@AutoConfigureAfter(FreemarkerFunctionAutoConfiguration.class)
public class FreemarkerAutoConfiguration extends FreeMarkerAutoConfiguration.FreeMarkerWebConfiguration {

    @Override
    public FreeMarkerConfigurer freeMarkerConfigurer() {
        FreeMarkerConfigurer configurer = super.freeMarkerConfigurer();
        configurer.setFreemarkerVariables(FreemarkerFunctionAutoConfiguration.sharedVariables);

        return configurer;
    }
}

