1. 程式人生 > >SpringBoot中的常用配置

SpringBoot中的常用配置

comm highlight tar -type cati pid 添加 maven項目 http請求

一 . 關於在application.properties文件中的一些常見配置

    1.server.port=8888 :表示配置端口

    2.server.context-path  表示自定義上下文路徑

    3.server.tomcat.uri-encoding = UTF-8 表示用於解碼URI的字符編碼。

    4.spring.http.encoding.charset = UTF-8 #HTTP請求和響應的字符集。如果未明確設置,則添加到“Content-Type”頭。

    5.啟用健康檢查,首先必須先要添加支持的jar包

      配置在maven項目下的pom.xml文件中

    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>   

    6.#關閉actutor的安全認證
    7.#http://localhost:8888/sb/health 查看springboot健康狀況是否良好
    8.#http://localhost:8888/sb/beans 類似於struts<s:debug>
    9.#http://localhost:8888/sb/dump dump出線程和內存使用情況
    10.#http://localhost:8888/sb/env java和springboot的環境變量
    11.management.security.enabled=false
    12.#啟動url shutdown
      endpoints.shutdown.enabled=true

SpringBoot中的常用配置