title: How to access system properties in Thymeleaf template?
body: <p>I need to access system properties in a Thymeleaf template. It would be nice if this was possible so that I don't have to populate the spring mvc model explicitly with properties. I'm trying to use SPEL for this purpose but it's not working.</p>
  
  <pre><code>&lt;h2 th:text="${ systemProperties['serverName'] }"&gt;Service name&lt;/h2&gt;
  
  &lt;h2 th:text="*{ systemProperties['serverName'] }"&gt;Service name&lt;/h2&gt;
  </code></pre>
  
  <p>Both of these give me:</p>
  
  <pre><code>Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1012E:(pos 17): Cannot index into a null value
  </code></pre>
  
  <p>Even if I try to access a jdk property it gives the same error so I know it's not the fact that the property is missing. What am I doing wrong or is there another way to do this?</p>