springboot配置yml文件

1、訪問靜態資源配置:

可參考:https://blog.csdn.net/zhoucheng05_13/article/details/78197766

https://blog.csdn.net/qq_16393511/article/details/83751092

spring:
  jackson:
        #指定日期格式,比如yyyy-MM-dd HH:mm:ss
        date-format: yyyy-MM-dd HH:mm:ss
        #指定日期格式化時區
        time-zone: GMT+8
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/test?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
    username: root
    password: root
  resources:
    #用於告訴Spring Boot應該在何處查找靜態資源文件,查找文件時會依賴於配置的先後順序依次進行
    static-locations: classpath:/statics/,classpath:/view/
  thymeleaf:
    prefix: classpath:/templates/
    suffix: .html
    check-template-location: true
    encoding: utf-8
  mvc:
    # 應該以什麼樣的路徑來訪問靜態資源,這表示只有靜態資源的訪問路徑爲/static/ 時纔會處理(如http://localhost:8080/static/css/base.css)
    static-path-pattern: /**
server:
  port: 8080
  servlet:
    context-path: /demo

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章