title: Freemarker - only use getter for beans
body: <p>I have some builder functions in my entities, which cannot be handled by freemarker. </p>
  
  <p>For example, I have the following bean/entity:</p>
  
  <pre><code>public class User{
  
      private Long number;
  
      public Long getNumber(){
          return this.number;
      }
  
      public void setNumber(Long number){
          this.number = number;
      }
  
      public User number(Long number){
          this.number = number;
      }
  }
  </code></pre>
  
  <p>And my freemarker template is something like this:</p>
  
  <pre><code>&lt;span&gt;${user.number}&lt;/span&gt;
  </code></pre>
  
  <p>which I process on the fly as follows:</p>
  
  <pre><code>User user = getUser();
  Map&lt;String, Object&gt; context = new HashMap&lt;&gt;();
  contaxt.put("user", user);
  Configuration configuration = new Configuration(Configuration.VERSION_2_3_0);
  configuration.setObjectWrapper(new BeansWrapper(Configuration.VERSION_2_3_0));
  Template t = new Template("usertpl", template, configuration);
  String result = FreeMarkerTemplateUtils.processTemplateIntoString(t, model);
  </code></pre>
  
  <p>Since my entity contains a method "number(Long)", freemarker tries to use this, which is actually a setter - so it is not working. </p>
  
  <p>I know, that i can use the getter in the template, but the template should be defined by users (where I think <code>${user.number}</code> is more comprehensible than <code>${user.getNumber()}</code> for those who are not programmers)</p>
  
  <p>So, I'm searching for another solution...</p>
  
  <p>Is there a possibility to configure freemarker so that it only uses the getter (<code>getNumber()</code>) to access the property, instead of using the <code>number(Long)</code>? </p>