Thymeleaf在IDEA中的红色波浪线问题

在IDEA中写Thymeleaf的语法,经常会遇到IDEA提示Thymeleaf语法错误,我推荐三个方法解决。

第一个方法:(一劳永逸)

未做设置之前

Thymeleaf在IDEA中的红色波浪线问题

一劳永逸的,在File->Settings->Editor->inspections右边找到Thymeleaf下的Expression variables validation(当然也可以搜索)

Thymeleaf在IDEA中的红色波浪线问题

做了设置之后

Thymeleaf在IDEA中的红色波浪线问题

第二个方法:

未加上<!--suppress ALL-->前

Thymeleaf在IDEA中的红色波浪线问题

在 <!DOCTYPE html> 下加上 <!--suppress ALL-->

Thymeleaf在IDEA中的红色波浪线问题

加上  <!--suppress ALL--> 后

Thymeleaf在IDEA中的红色波浪线问题

第三个方法:

未加注释之前

Thymeleaf在IDEA中的红色波浪线问题

加上注释之后,可以看到,已经没显示红色波浪线了

Thymeleaf在IDEA中的红色波浪线问题