Value ‘0’ is not a valid duration

今天在优化代码的时候发现 springboot的yml配置文件中两处爆红,将鼠标放上去,提示:Value ‘0’ is not a valid duration

Checks Spring Boot application .yaml configuration files. Highlights unresolved and deprecated configuration keys and invalid values.

报错的两处:

server:
  servlet:
    session:
      timeout: 0
      cookie:
        max-age: -1

于是百度了一下:将上面两处加上单位就可以了。比如:

server:
  servlet:
    session:
      timeout: 0s
      cookie:
        max-age: -1s

其中数字后面跟的:s代表秒、m代表分、h代表小时、d代表天。

参考:http://www.leftso.com/blog/486.html


45 Clicks !