当前位置: 首页 > wzjs >正文

做市场调查的网站免费建设网站需要展示什么名字

做市场调查的网站免费,建设网站需要展示什么名字,百度竞价推广托管,微信公众号怎么做文章编辑在 Spring Boot 3 中整合 FastJSON 2 主要涉及到以下几个步骤,包括添加依赖、配置 FastJSON 作为 JSON 处理器等。下面是详细的步骤: 1. 添加依赖 首先,你需要在你的 pom.xml 文件中添加 FastJSON 2 的依赖。以下是 Maven 依赖的示例&#…

在 Spring Boot 3 中整合 FastJSON 2 主要涉及到以下几个步骤,包括添加依赖、配置 FastJSON 作为 JSON 处理器等。下面是详细的步骤:

1. 添加依赖

首先,你需要在你的 pom.xml 文件中添加 FastJSON 2 的依赖。以下是 Maven 依赖的示例:

<!-- https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2-extension-spring6 -->
<dependency><groupId>com.alibaba.fastjson2</groupId><artifactId>fastjson2-extension-spring6</artifactId><version>2.0.53</version>
</dependency><!-- https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2 -->
<dependency><groupId>com.alibaba.fastjson2</groupId><artifactId>fastjson2</artifactId><version>2.0.53</version>
</dependency>
2. 配置 FastJSON 作为 JSON 处理器

在 Spring Boot 3 中,默认的 JSON 处理器是 Jackson。如果你想使用 FastJSON 作为 JSON 处理器,你需要创建一个配置类来注册 FastJSON 的 HttpMessageConverter

import com.alibaba.fastjson2.support.config.FastJsonConfig;
import com.alibaba.fastjson2.support.spring6.http.converter.FastJsonHttpMessageConverter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;@Slf4j
@Configuration
public class Fastjson2Config implements WebMvcConfigurer {/*** Fastjson2Config* @author <a href="https://zhengkai.blog.csdn.net/">zhengkai.blog.csdn.net</a>*/@Overridepublic void configureMessageConverters(List<HttpMessageConverter<?>> converters) {FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();FastJsonConfig config = new FastJsonConfig();config.setDateFormat("yyyy-MM-dd HH:mm:ss");// 其他配置...converter.setFastJsonConfig(config);converter.setDefaultCharset(StandardCharsets.UTF_8);converter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));converters.add(0, converter);log.info("Fastjson2 Initial Done");}
}
3. 使用 FastJSON2 进行 JSON 序列化和反序列化

在你的 Spring Boot 应用中,你可以直接使用 FastJSON 的 API 进行 JSON 的序列化和反序列化。例如:

import com.alibaba.fastjson2.JSON;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;@RestController
public class SampleController {@GetMapping("/json")public String getJson() {MyObject obj = new MyObject();obj.setName("Test");obj.setValue(123);// 使用 FastJSON 进行序列化return JSON.toJSONString(obj);}public static class MyObject {private String name;private int value;// Getter 和 Setterpublic String getName() {return name;}public void setName(String name) {this.name = name;}public int getValue() {return value;}public void setValue(int value) {this.value = value;}}
}
4. 测试

启动你的 Spring Boot 应用,并访问 /json 路径,你应该能够看到 FastJSON 生成的 JSON 响应。

开源项目

SpringBoot3脚手架,基于SpringBoot3+Druid+PgSQL+MyBatisPlus13+FastJSON2+Lombok,启动web容器为Undertow(非默认tomcat),其他的请自行添加和配置。

https://gitee.com/moshowgame/MySpringBootAPIhttps://github.com/moshowgame/MySpringBootAPI


文章转载自:

http://3qyO0tPp.wfbmr.cn
http://RmLRBkbg.wfbmr.cn
http://tGBzw21K.wfbmr.cn
http://0FZZXeZS.wfbmr.cn
http://7WYx92UY.wfbmr.cn
http://SdqWu90P.wfbmr.cn
http://6MN5tcX7.wfbmr.cn
http://Ci9bC0n8.wfbmr.cn
http://vB5yCTi0.wfbmr.cn
http://albejyOF.wfbmr.cn
http://oekKmd6t.wfbmr.cn
http://E6zqX1l7.wfbmr.cn
http://EpEz43h7.wfbmr.cn
http://kZgZQ8hx.wfbmr.cn
http://pVNjzyGK.wfbmr.cn
http://9lMdbEsG.wfbmr.cn
http://1duIrQyv.wfbmr.cn
http://Kexm7Wkk.wfbmr.cn
http://Igy2cUKt.wfbmr.cn
http://zQGC7Hie.wfbmr.cn
http://rUQaEiOz.wfbmr.cn
http://6MtltlrB.wfbmr.cn
http://hsYuEuLQ.wfbmr.cn
http://nOnlgStG.wfbmr.cn
http://JT9dEvOM.wfbmr.cn
http://Ajpj5T9O.wfbmr.cn
http://P7u8DzV1.wfbmr.cn
http://fgtAQcy0.wfbmr.cn
http://wcN6Dv2L.wfbmr.cn
http://FRTvqp0x.wfbmr.cn
http://www.dtcms.com/wzjs/766973.html

相关文章:

  • php网站源码免费下载88黄页网发帖效果好吗
  • 网站中搜索关键词百度一下百度搜索入口
  • 一个网站多台服务器第一ppt模板网站
  • 天津西青区天气预报湛江seo
  • 保健食品东莞网站建设和田地网站seo
  • 企业建立网站的原因网站建设公司 预算
  • 做网站要什么知识条件站长工具站长之家官网
  • 企业网站做app做网单哪个网站最好用
  • 南宁网站建设网站建设wordpress 自适应cms主题
  • 网站备案后换空间阿里巴巴怎么建设网站首页
  • 免费网络电话试用专业seo关键词优化
  • 惠阳惠州网站建设江苏省工程造价信息网
  • 网站建设gzzhixun用php做的单车租赁网站
  • 镜像网站是如何做的3g微网站是什么
  • 什么软件可以做网站html深圳电力建设公司网站
  • 太原网站建设列表网网站上的链接怎么做的
  • wap微信网站模板黑龙江 哈尔滨
  • 兰州做网站es5188谷歌上怎样做网站
  • 网站代码建设 实例白色网站配色
  • 佛山市建设局网站互联网平台是什么意思
  • 网站建设技能wordpress 后台制作
  • 给人家做网站服务器自己搭吗wordpress网站怎么优化
  • 建立企业网站的详细步骤线上商城系统
  • 网站开发实战 王机械外协加工网最新订单
  • 如何建平台网站杭州网站做的好公司哪家好
  • 网站做电子公章违法吗网站管理建设的总结
  • 网站建设首选易网宣网页设计品牌故事
  • 网站上怎么做返回主页链接公司官网制作多少钱
  • 娄底市住房和城乡建设局官方网站h5网站制作网站开发
  • 网站开发有什么网站广东网站建设公司排名