软件编程
位置:首页>> 软件编程>> java编程>> springboot乱码问题解决方案

springboot乱码问题解决方案

作者:jason小蜗牛  发布时间:2022-03-22 21:32:38 

标签:spring,boot,乱码

这篇文章主要介绍了springboot乱码问题解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

在配置文件中添加


#编码设置
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
server.tomcat.uri-encoding=UTF-8

使用springboot:run运行时控制台输出乱码问题,在pom文件中添加如下配置


<build>
   <plugins>
     <plugin>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-maven-plugin</artifactId>
       <!--解决maven插件启动时中文乱码问题-->
       <configuration>
         <fork>true</fork>
         <!-- spring-boot:run 中文乱码解决 -->
         <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
       </configuration>
     </plugin>
   </plugins>
 </build>

来源:https://www.cnblogs.com/jasonboren/p/12264157.html

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com