class ThymeleafSvgConfig implements ApplicationContextAware {

    @Bean
    public ThymeleafViewResolver svgViewResolver(final SpringTemplateEngine templateEngine) {
        final ThymeleafViewResolver thymeleafViewResolver = new ThymeleafViewResolver();
        thymeleafViewResolver.setTemplateEngine(templateEngine);
        thymeleafViewResolver.setOrder(0);
        thymeleafViewResolver.setCharacterEncoding("UTF-8");
        thymeleafViewResolver.setContentType("image/svg+xml");
        thymeleafViewResolver.setViewNames(new String[] {"*.svg"});
        return thymeleafViewResolver;
    }

}