在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Java  Python  網(wǎng)絡(luò)安全/ 求教Springboot用Fastjson解析后,如何只應(yīng)用于requestBo

求教Springboot用Fastjson解析后,如何只應(yīng)用于requestBody,返回對象還是用原來的?

用了Fastjson,如何只讓它處理請求報文,返回報文不處理,還是用SpringBoot原來的處理方式?

添加Fastjson轉(zhuǎn)換器的代碼如下:

    @Bean
    public HttpMessageConverters fastJsonHttpMessageConverters() {
        // 創(chuàng)建FastJson配置
        FastJsonConfig fastJsonConfig = new FastJsonConfig();
        fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteNullStringAsEmpty);
        
        // 創(chuàng)建converter消息轉(zhuǎn)換對象
        FastJsonHttpMessageConverter4 fastJsonConverter = new FastJsonHttpMessageConverter4();
        fastJsonConverter.setFastJsonConfig(fastJsonConfig);
        
        return new HttpMessageConverters(fastJsonConverter);
    }

以上代碼在請求與返回都生效了,如何只讓它在請求時生效,返回不處理?

感謝各位?。?/p>

回答
編輯回答
局外人

不行就只能換回Jackson了

2017年2月3日 09:16