title: Spring boot get application base url outside of servlet context
body: <p>The setup is following - I have a timed task that would send verification emails so users:</p>
  
  <pre><code>@Scheduled(cron = " 0 0-59/1 * * * * ")
  public void sendVerificationEmails() {
      //...
  }
  </code></pre>
  
  <p>And in those emails I need to include a link leading back to the same webapp. However I can not find any references of how to get app's base url without servlet context.</p>
  
  <p><strong>BONUS</strong></p>
  
  <p>It would also help if I could set up thymeleaf template resolver here to work with those links, but for that I need a <code>WebContext</code> which requires an instance of <code>HttpServletRequest</code>.</p>