spring boot:run控制檯輸出中文亂碼問題的解決
阿新 • • 發佈:2019-02-01
自己搭的spring boot在控制檯輸出中文的時候會出現亂碼的情況,如下圖所示:
解決方法:
在pom檔案中增加配置,增加一項虛擬機器引數,完整程式碼如下:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- spring-boot:run 中文亂碼解決 -->
<configuration>
<fork >true</fork>
<!--增加jvm引數-->
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId >
<version>1.2.5.RELEASE</version>
</dependency>
</dependencies>
</plugin>
結果如下,亂碼問題成功解決