记录一次 使用thymeleaf循环标签异常问题。
问题原因:测试环境数据库数据都是正常数据,去重查询 出LIst<Map<String,String>> 类型数据,sql中只过滤了 value 不为空,没过滤key空值。
页面直接循环:
<option th:each="company :${systemList}" th:value="${company.value}" th:text="${company.key}"data-select2-id="2"></option>
生产环境上直接报错:一脸懵逼。
org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'DATASYS' cannot be found on object of type 'java.util.HashMap' - maybe not public or not valid?
开始排查最后发现Map<String,String> 存在空值导致的