Spring boot http编码配置,以及各个项的详细说明

spring web项目中需要在添加CharacterEncodingFilter

springboot中只需要在配置文件中添加以下配置

spring.http.encoding.charset=UTF-8

spring.http.encoding.enabled=true 

spring.http.encoding.force=true 

参考springboot官方文档

https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

属性配置详细说明

# HTTP encoding (HttpEncodingProperties)
# Charset of HTTP requests and responses. Added to the "Content-Type" header if not set explicitly.
# HTTP请求和响应的字符集。如果未显式设置,则添加到“内容类型”头。

spring.http.encoding.charset=UTF-8 

# Whether to enable http encoding support.
# 是否启用http编码支持。

spring.http.encoding.enabled=true 

# Whether to force the encoding to the configured charset on HTTP requests and responses.
# 是否强制对HTTP请求和响应上配置的字符集进行编码。

spring.http.encoding.force=true 

# Whether to force the encoding to the configured charset on HTTP requests. Defaults to true when "force" has not been specified.
# 是否强制对HTTP请求上配置的字符集进行编码。未指定“force”时默认为true。

spring.http.encoding.force-request= true

# Whether to force the encoding to the configured charset on HTTP responses.
# 是否强制对HTTP响应上配置的字符集进行编码。

spring.http.encoding.force-response= true

# Locale in which to encode mapping.
要在其中编码映射的区域设置。

spring.http.encoding.mapping= 


 

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值