title: How to generate confirmation code without a conflict in Spring Boot API?
body: <p>I am making an website that has register and login functionality which works fine. However, I want to add confirmation code process after the registration process. </p>
  
  <p>I can create a random confirmation code in frontend(Angular) side and send it with <code>SMTP</code> protocol to user email account and user should enter this confirmation code in 2 minutes. However when I think more, it can cause a conflict(very slight possibility but not impossible) like it can be generated same confirmation code in 2 minutes.</p>
  
  <p>So, now I decided to generate confirmation code in backend side(Spring Boot) and make the confirmation checking in backend side. So, in backend side I should check the generated confirmation code is generated already in 2 minutes. </p>
  
  <p>Thus, I can use a dynamic list that has active confirmation codes and search the generated confirmation code in the list. If the code exist in the list, then create another one until the list doesn't have.</p>
  
  <p>How can I create a dynamic global list that can be visible among all different request in Spring Boot?
  Or there is another way(best practice) for this confirmation process?</p>