Tommy

Tommy

写代码是热爱,但也是生活 !
github

FastJson Configuration

    @Bean// Use @Bean to inject fastJsonHttpMessageConvert
    public HttpMessageConverter fastJsonHttpMessageConverters() {
        // 1. Need to define an object for converting messages
        FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
        FastJsonConfig fastJsonConfig = new FastJsonConfig();
        fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
        fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
		
        SerializeConfig.globalInstance.put(Long.class, ToStringSerializer.instance);

        fastJsonConfig.setSerializeConfig(SerializeConfig.globalInstance);
        fastConverter.setFastJsonConfig(fastJsonConfig);
        HttpMessageConverter<?> converter = fastConverter;
        return converter;
    }

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        converters.add(fastJsonHttpMessageConverters());
    }
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.