title: Class Cast Exception : cannot be cast to class
body: <p>I am following a below tutorial on how to send email using spring boot</p>
  <p><a href="https://www.technicalkeeda.com/spring-boot-tutorials/how-to-send-email-using-spring-boot" rel="nofollow noreferrer">https://www.technicalkeeda.com/spring-boot-tutorials/how-to-send-email-using-spring-boot</a></p>
  <p>I implemented it in spring boot and it is working fine. Now I am trying to implement this in my visual studio code project. I did as mentioned in the tutorial. But I am getting this error when I run my project which I cannot understand and am unable to resolve.</p>
  <pre><code>Exception in thread &quot;main&quot; java.lang.ClassCastException: class 
  MailServiceImpl cannot be cast to 
  class MailService (MailServiceImpl and MailService are in unnamed module of 
  loader 'app') at
  Application.main(Application.java:28)
  </code></pre>
  <p>To see my MailService and MailServiceImpl Classes, please visit the mentioned link.Kindly help!</p>