title: Why do we need service layer?
body: <p>I'm currently learning Spring Boot and I've seen how people create a controller, inject the service class and in the service class inject the repository.</p>
  
  <p>Why do we need the service class as a middleman and why can't we just inject the repository into controller?</p>
  
  <p>Here's the tutorial that confused me: <a href="https://www.youtube.com/watch?v=lpcOSXWPXTk&amp;list=PLqq-6Pq4lTTbx8p2oCgcAQGQyqN8XeA1x" rel="noreferrer">https://www.youtube.com/watch?v=lpcOSXWPXTk&amp;list=PLqq-6Pq4lTTbx8p2oCgcAQGQyqN8XeA1x</a></p>