springboot 版本2.2.7.release
在build.gradle中設置thymeleaf-extras-springsecurity爲 compile(‘org.thymeleaf.extras:thymeleaf-extras-springsecurity5’)
同時在html中設置 xmlns:sec=“http://www.thymeleaf.org/thymeleaf-extras-springsecurity5”
詳見https://segmentfault.com/a/1190000021529294