package com.jay.monitor.data.server.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * mvc层定义
 *
 * @author Liuhx
 * @create 2018/6/14 18:41
 * @email liuhx@elab-plus.com
 **/
@Configuration
@EnableWebMvc
//@EnableSwagger2
@ComponentScan(basePackages = {"com.jay.monitor.data.server.controllers"})
//@ConfigurationProperties(prefix = "swagger2")
public class MvcConfigBean extends WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        super.addResourceHandlers(registry);
        registry.addResourceHandler("/js/**").addResourceLocations("classpath:/static/js/");
        registry.addResourceHandler("/css/**").addResourceLocations("classpath:/static/css/");
        registry.addResourceHandler("/lib/**").addResourceLocations("classpath:/static/lib/");
        registry.addResourceHandler("/fonts/**").addResourceLocations("classpath:/static/fonts/");
    }

//    @Bean
//    public TemplateEngine layoutDialect() {
//        // Or SpringTemplateEngine for Spring
//        TemplateEngine templateEngine = new TemplateEngine();
//        templateEngine.addDialect(new LayoutDialect(new GroupingStrategy()));
//        return templateEngine;
//    }
}
