All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.xincao9.jswitcher.ui.config.WebConfig Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
package com.github.xincao9.jswitcher.ui.config;

import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import java.util.List;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web配置
 * 
 * @author [email protected]
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    /**
     * 配置视图
     *
     * @param registry
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("keys"); // 首页
    }

    /**
     * 设置消息转化器
     * 
     * @param converters 消息转化器
     */
    @Override
    public void configureMessageConverters(List> converters) {
        FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
        FastJsonConfig fastJsonConfig = new FastJsonConfig();
        fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
        converter.setFastJsonConfig(fastJsonConfig);
        converters.add(converter);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy