title: Best way to set up account before first time application startup
body: <p>I just started a Spring boot project where my first task is to make sure that when application starts for the first time admin user account is created. I was just wondering what would be the best way to implement such functionality or to use some kind of build in Spring functionality.</p>
  
  <p>Right now in my project each time when user access <a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a> I am checking if list of the users is empty or not:</p>
  
  <pre><code> List&lt;User&gt; users = userService.getAllUsers();
          if(users.isEmpty()){
              modelAndView.setViewName("register");
          } else {
              modelAndView.setViewName("home");
          }
  </code></pre>
  
  <p>If user service will return empty List user will be redirected to register view.</p>
  
  <p>In my opinion for sure there is better way to do it but because of lack of knowledge I don't know in which direction I should go.</p>
  
  <p>Can someone suggest what would be the best solution?
  Is there a build in Spring functionality which I can use?</p>