title: Spring Boot @RequestParam default value if boolean expression is true
body: <p>I want to make a request deliver a default value if a boolean expression evaluates to true and the given parameter else. What would be the &quot;Spring&quot; way to do this without writing the if-block in every method?</p>
  <pre class="lang-java prettyprint-override"><code>@RequestMapping(&quot;/&quot;)
    public String get(@RequestParam String parameter) {
      if (expression)
        return default;
      return parameter;
  }
  </code></pre>