package com.nicefish;

import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/*@SpringBootApplication(scanBasePackages={
        "com.nicefish.config","com.nicefish.common","com.nicefish.service",
        "com.nicefish.message","com.nicefish.swagger","com.nicefish.web"})*/
@SpringBootApplication
@RestController
@MapperScan(basePackages = {"com.nicefish.mapper"})
public class NicefishApplication {

    @RequestMapping("/")
    public String greeting() {
        return "Hello World,kimmking!";
    }

    public static void main(String[] args) {
        SpringApplication.run(NicefishApplication.class, args);
    }

    @Bean
    public HttpMessageConverters fastjsonHttpMessageConverter(){
        FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
        FastJsonConfig jsonConfig = new FastJsonConfig();
        jsonConfig.setSerializerFeatures(
                SerializerFeature.PrettyFormat,
                SerializerFeature.QuoteFieldNames
        );
        jsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
        converter.setFastJsonConfig(jsonConfig);
        List<MediaType> mediaTypes = new ArrayList<>();
        mediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
        converter.setSupportedMediaTypes(mediaTypes);
        return new HttpMessageConverters(converter);
    }
}

@@ -1181,16 +1181,39 @@
  return 
+%22%7B%5Cn%5Ct%5Ct %5C%22greeting%5C%22:%5C
 %22Hello W
@@ -1226,16 +1226,21 @@
 immking!
+%5C%22%5Cn%7D
 %22;%0A    %7D

format greeting