package org.synyx.urlaubsverwaltung;

import no.api.freemarker.java8.Java8ObjectWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
import org.springframework.boot.autoconfigure.freemarker.FreeMarkerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class FreemarkerConfig extends FreeMarkerAutoConfiguration {

    @Autowired
    private freemarker.template.Configuration configuration;

    public FreemarkerConfig(ApplicationContext applicationContext, FreeMarkerProperties properties) {
        super(applicationContext, properties);
    }

    @PostConstruct
    public void postConstruct() {
        configuration.setObjectWrapper(
            new Java8ObjectWrapper(freemarker.template.Configuration.getVersion()));
    }

}

@@ -86,71 +86,8 @@
 er;%0A
-import org.springframework.beans.factory.annotation.Autowired;%0A
 impo
@@ -492,23 +492,8 @@
  %7B%0A%0A
-    @Autowired%0A
     
@@ -500,16 +500,22 @@
 private 
+final 
 freemark
@@ -654,16 +654,65 @@
 operties
+, freemarker.template.Configuration configuration
 ) %7B%0A    
@@ -754,16 +754,60 @@
 rties);%0A
+        this.configuration = configuration;%0A
     %7D%0A%0A 
@@ -901,21 +901,8 @@
 per(
-%0A            
 new 
@@ -976,11 +976,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Replace field injection by constructor injection