springboot中velocity格式化timestamp

##toolbox.xmlspring

<toolbox>
    <tool>
        <key>date</key>
        <scope>application</scope>
        <class>org.apache.velocity.tools.generic.DateTool</class>
        <parameter name="format" value="yyyy-MM-dd HH:mm:ss"/>
    </tool>
</toolbox>

##vm中引用apache

$!date.format($!log.timestamp)

##配置toolbox的位置app

spring:
  velocity:
    charset: UTF-8
    properties:
      input:
        encoding: UTF-8
      output:
        encoding: UTF-8
    toolbox-config-location: toolbox.xml

##docscode

相關文章
相關標籤/搜索