Mastering Spring Boot Made Easy

Spring Boot Tutorial for Beginners [2025]

Estimated read time: 1:20

    Learn to use AI like a Pro

    Get the latest AI workflows to boost your productivity and business performance, delivered weekly by expert consultants. Enjoy step-by-step guides, weekly Q&A sessions, and full access to our AI workflow archive.

    Canva Logo
    Claude AI Logo
    Google Gemini Logo
    HeyGen Logo
    Hugging Face Logo
    Microsoft Logo
    OpenAI Logo
    Zapier Logo
    Canva Logo
    Claude AI Logo
    Google Gemini Logo
    HeyGen Logo
    Hugging Face Logo
    Microsoft Logo
    OpenAI Logo
    Zapier Logo

    Summary

    In "Programming with Mosh's" comprehensive guide to Spring Boot, beginners are taken on a journey from basic to advanced concepts, ultimately empowering them to craft real-world applications. The tutorial is divided into two segments; the first half delivers foundational knowledge while the latter half focuses on application and API development. Essential skills such as understanding Java, SQL, and Maven are prerequisites. Mosh introduces dependency injection, controller usage, debugging techniques, and property configurations - all pivotal in mastering Spring Boot. The course is structured to maximize hands-on learning, ensuring viewers not only follow along but also put their skills to the test, thereby solidifying their understanding and preparing them for real-world software engineering challenges.

      Highlights

      • Learn in a structured, easy-to-follow way with Mosh. ๐Ÿ“˜
      • In-depth understanding of dependency injection. ๐Ÿ› ๏ธ
      • Practical exercises to reinforce learning. ๐Ÿ’ก
      • Introduction to Spring Boot MVC for handling requests. ๐ŸŒ
      • Debug and optimize with IntelliJ's powerful tools. ๐Ÿ› ๏ธ

      Key Takeaways

      • Master Spring Boot effortlessly with Mosh Hamadani's guidance! ๐ŸŒŸ
      • Two-part course: fundamentals first, then application building. ๐Ÿ“š
      • Dependency Injection demystified for cleaner code. ๐Ÿงผ
      • Power up with Spring Boot's automatic configurations! โšก
      • Get hands-on with plenty of real-world examples. ๐Ÿ’ช

      Overview

      Spring Boot might seem daunting at first glance, but with Mosh Hamadani's structured teaching style, you'll go from novice to pro in no time! Mosh breaks down complex concepts into easy, digestible lessons that focus on practical applications. Whether you're setting up your environment, diving into dependency management, or crafting your first web application, this tutorial builds your confidence step by step.

        You'll start with the basics of Spring Boot, setting up your development environment with IntelliJ and discovering the magic of dependencies. As you progress, you'll delve into essential tools like Spring Boot DevTools, Maven, and Git. These sessions allow you to smoothly transition into more advanced topics, ensuring that you're not just learning to code but also preparing for real-world software development scenarios.

          Through engaging lectures and hands-on exercises, you'll grasp the core concepts of Spring Boot. Mosh emphasizes the importance of dependency injection, helping you write cleaner, more maintainable code. The course also covers key aspects like Spring Boot MVC, making it possible to handle and manage web requests effectively. By the end, you'll have built a solid foundation, ready to tackle the challenges of application development head-on.

            Chapters

            • 00:00 - 03:00: Welcome & Introduction The chapter titled 'Welcome & Introduction' is part of a comprehensive Spring Boot course designed to take learners from beginner to expert. It emphasizes learning from basics to advanced concepts aimed at empowering learners to build real-world applications confidently. The course is structured into two parts for streamlined learning. Currently, you are in the first part, which focuses on fundamental concepts, while the second part is dedicated to building web applications. The course promises to be well-organized, easy to follow, and practical, making it suitable for anyone looking to master Spring Boot.
            • 03:00 - 06:00: Course Structure The chapter titled 'Course Structure' introduces the course as being full of hands-on examples and real-world exercises, designed to help learners absorb and apply what they learn effectively. The instructor, M. Hamadani, highlights his extensive experience as a software engineer and educator, having taught millions through his platforms. He encourages new learners to subscribe to his channel for ongoing content.
            • 06:00 - 07:00: Getting Started This chapter serves as an introduction to mastering Spring Boot for building applications efficiently and confidently. It emphasizes the prerequisite knowledge needed for the course, specifically a strong understanding of Java and comfort with object-oriented programming concepts such as classes, methods, and interfaces. For those new to Java or in need of a review, a recommendation is made for further learning.
            • 07:00 - 09:00: Spring Framework & Spring Boot The chapter 'Spring Framework & Spring Boot' emphasizes the prerequisites required for the course, which include having a familiarity with Java, relational databases, and SQL. It recommends reviewing these topics if the concepts of tables, primary keys, foreign keys, and queries are unfamiliar. The chapter encourages further learning through recommended courses for those who need to strengthen their skills in these areas before proceeding further.
            • 09:00 - 12:00: Setting up Development Environment The chapter is titled 'Setting up Development Environment.' It is the introductory lesson for a course on Spring Boot. The course is divided into two parts: the first part covers the fundamentals of Spring Boot, while the second part focuses on building web applications and APIs. This initial part aims to build a strong foundational understanding of Spring Boot before advancing to more complex topics.
            • 12:00 - 16:00: Creating a New Spring Boot Project In this chapter, we focus on the foundational aspects of building applications using Spring Boot. It is divided into three main sections.
            • 16:00 - 21:00: Dependency Injection The chapter on 'Dependency Injection' provides an in-depth discussion on integrating databases using Spring Data JPA. It emphasizes the importance of understanding and mastering the essential tools and practices for efficiently managing data access in real-world applications. Unlike other courses, this content covers fundamental and often overlooked concepts, ensuring a thorough understanding of efficient data access patterns and best practices. It's recommended to follow the course in sequence to grasp the complexities, as each lesson builds on the previous ones. The chapter is also rich in exercises designed to reinforce the knowledge shared.
            • 21:00 - 24:00: Getting the Most from the Course This chapter emphasizes the importance of attempting each exercise independently before viewing the solution, as the struggle aids in better retention of concepts. It encourages students to engage actively with the course material to gain the most benefit. Additionally, for reference and easy following along, the exact code used in lessons is organized in a GitHub repository for student access.

            Spring Boot Tutorial for Beginners [2025] Transcription

            • 00:00 - 00:30 [Music] welcome to the ultimate spring boot course in this course you'll learn everything you need to know from the basics to more advanced concepts so by the end you'll be able to build real world applications with confidence if you're looking for a comprehensive easy to follow well structured and practical course that takes you from Zero to Hero this is the spring boot course for you I've organized this course in two parts the first part which you're watching now covers the fundamental concepts and the second part focuses on building web
            • 00:30 - 01:00 applications and apis the course is packed with Hands-On examples and real world exercises to help you truly absorb and apply what you learn I've poured my heart and soul into creating this course and I'm confident it will be a game Cher for your skills I'm m hamadani a software engineer with over 20 years of experience and I've taught Millions how to code and become professional software Engineers through my YouTube channel and online school codm mar.com if you're new here make sure to subscribe as I upload new videos all the time so if you're
            • 01:00 - 01:30 ready to master spring Boot and build applications with confidence let's jump in and get [Music] started to get the most out of this course you should have a solid understanding of java you should be comfortable with objectoriented programming working with classes methods and interfaces if you're new to Java or need a refresher I recommend going
            • 01:30 - 02:00 through my Java course before starting this one I'll put the link down below you should also be familiar with relational databases and SQL you should know Concepts like tables primary Keys foreign keys and writing basic queries if this sounds new to you or you want to strengthen your SQL skills check out my SQL course where I cover everything from the basics to more advanced queries that's all you need to get started if you already meet these prerequisites you're good to go otherwise take some time to review Java and SQL before jumping in now let's move on to the next
            • 02:00 - 02:30 [Music] lesson before we dive in let's talk about how I've structured this course so you know what to expect and how to get the most out of it this course is divided into two parts the first part which you're watching now covers the fundamentals of spring boot the second part will focus on building web applications and apis in the first part we'll go step by step to build a strong foundation so that when we move on to
            • 02:30 - 03:00 building applications you will have all the essential skills you need part one is divided into three sections we'll Begin by understanding what spring boot is and why it's such a powerful framework we'll also set up our development environment and build our first spring boot project so we can get a feel for how everything works then we have dependency injection in this section you will learn how spring boot manages objects and their dependencies behind the scenes making our applications more modular testable and maintain aable in the next section we
            • 03:00 - 03:30 talk about database integration with spring data jpa this is the bread and butter of part one we cover Concepts that are often overlooked in other courses you will learn best practices efficient data access patterns and tools that are essential for building real world applications to get the most out of this course watch every lesson in sequence I cover a lot of details that built on previous Concepts so skipping around might cause you to miss something important this course is also packed with exercises to reinforce what you
            • 03:30 - 04:00 learn I strongly encourage you to complete each exercise before watching my solution struggling a bit before seeing the answer will help you retain the concepts much better now that you know how the course is structured let's move on to the next [Music] lesson as you go through the course you'll often want to check out the exact code I write in each lesson so to make it easy for you to follow along I've organized the source code using a GitHub rep repository that you can find at
            • 04:00 - 04:30 github.com hamedani sspring store now technically you don't need to know git to take this course but git is one of those skills that every developer must have if you want to dive deep and truly Master git I have a complete git course on my website where I teach everything from the fundamentals to Advanced workflows you can find it on codewithc now back to our repository in this repository each commit represents a lesson so if you want to see the exact
            • 04:30 - 05:00 code I write in this lesson just click here and you can see the changes also I've created tags for the beginning of each section for example if you want to start from part one section 4 you can use this tag it's not something that I recommend unless you're an advanced student because there's so much that we're going to cover in this course and ideally you should watch every lesson in order so that's all about our git repository let's move on and continue learning
            • 05:00 - 05:30 learning welcome to the first section of the course in this section we'll take our first steps with spring boot we'll start by learning what spring boot is and why it's so popular among Java developers next we'll get our development environment set up and create our first spring wood project I'll walk you through the project structure so you understand how everything is organized from there we'll dive into dependency management then build and run our first spring wood application we'll also cover some essential tools like spring boot Dev
            • 05:30 - 06:00 tools that make development faster and easier you will learn how to configure your app with properties and how to debug it when things go wrong by the end of this section you'll be comfortable setting up and running spring boot projects and you will have your first application up and running now let's get [Music] started before we jump into writing code let's take a few minutes and talk about what spring framework is what it off offers and how spring boot Builds on it
            • 06:00 - 06:30 to make our lives easier let's start with the spring framework it's a popular framework for building Java applications think of it as a toolbox for building applications it has a lot of modules each designed to handle a specific task these modules are broadly categorized into a few different layers at the core we have modules for handling dependency injection and managing objects we'll talk about that in detail in the next section in the web layer we have modules for building web applications with these
            • 06:30 - 07:00 modules we can handle web requests process data and return responses whether it's HTML for a web page or Json for an API in the data layer we have modules for working B databases whether you're using SQL no SQL or even inmemory databases we also have a module for adding cross cutting features like logging or security without cluttering the main code this is called aop or aspect oriented programming we also have a module for testing of spring components now the beauty of spring is
            • 07:00 - 07:30 that it's modular so you can pick and choose the modules you need for your project it's powerful and flexible which is why so many developers love it now while the spring framework is powerful using it often involves a lot of configuration for example if you want to build a web application you might need to set up a web server configure routing and manage dependencies manually this can make development slower and more complex that's where spring boot comes in think of spring boot as a layer on top of the spring framework that takes care of all the tedious setup for you it
            • 07:30 - 08:00 simplifies spring development by providing sensible defaults and ready to use features so why does this matter with spring boot you can go from idea to work in application in minutes instead of hours it saves you time reduces boilerplate code and lets you focus on what really matters building great features for your users by the way the spring framework is just one part of a larger family of projects in the spring ecosystem these projects extend the capabilities of the framework to address
            • 08:00 - 08:30 specific needs for example we have spring data for simplifying database access we have Spring Security for adding authentication and authorization to our applications we have spring batch for batch processing spring Cloud for building microservices and distributed systems we have spring integration for simplify messaging and integration between systems and more now that you understand what the spring framework and spring boot are and how they fit in the larger spring ecosystem let's start building [Music]
            • 08:30 - 09:00 before we start building applications with spring boot we need to get our development environment ready first you need the latest version of the Java development kit or jdk so open up your browser and search for download jdk you can find it on article.com now at the time of this video the latest version is jdk 23 it is possible that in the future when you're watching this video there is a newer version of jdk available that's not
            • 09:00 - 09:30 going to make this course outdated because what I'm going to teach you in this course will apply to Future versions of jdk as well so download the latest version of jdk here as you can see there are distributions for different operating systems Linux Mac OS and windows once you download and install the latest version of jdk open up your terminal window and run Java Dash version to verify that the jdk is installed correctly so as you can see on this this machine I'm running jdk
            • 09:30 - 10:00 version 23 next we need a code editor in this course I'll be using intelligent idea that's the most popular ID for professional Java and cotland development intelligent idea comes with a variety of built-in tools specifically designed for productive development with spring boot you can also consider alternatives like vs code or Eclipse I personally love intelligent idea especially because of its smart editor it not only autocompletes method name but also suggests entire chunks of code
            • 10:00 - 10:30 that you can insert with a single P of tab you'll see me doing that throughout the course this makes it much easier to write high quality code faster without getting stuck on syntax or boilerplate I highly recommend using intelligent idea for this course because it simplifies your workflow and helps you focus on learning spring boot instead of dealing with setup issues and here is something great thanks to Jet brins the creators of powerful IDs plugins and services you can try intelligent idea ultimate free
            • 10:30 - 11:00 for 3 months using the link and promo code below this video now the next step is installing a build automation tool for building and packaging our application here we have two options Maven and Gradle different people have different preferences but in this course we'll be using Maven because it's more popular now if you're using intell you don't need to install Maven separately because intellig has Maven built-in that's one of the reasons I said intellig makes it much easier to get started it comes with all the tools you
            • 11:00 - 11:30 need to build spring wood applications but otherwise if you're using vs code or Eclipse you'll have to install Maven separately you can download Maven from Maven apache.org now if you're on a Mac you can install Maven with Homebrew it's much easier so open up your terminal first run Brew update and then run Brew install Maven it's much easier to install it this way if you're on Windows I recommend installing Maven using chocolatey in case you are not familiar with it it's a package manager for
            • 11:30 - 12:00 Windows so first head over to choc.org download and install chocy then open your terminal window and run choco install Maven now once you're done to verify that Maven is installed properly run mvn DV so on this machine I'm running Apache Maven 3.9 [Music]
            • 12:00 - 12:30 now there are two ways to create a new spring boot project one way is to go to start. spring.io on this page we can select a few options and generate a new spring boot project so first we specify our build tool which can be gril or Maven by default Maven is selected so we keep it as is next we select our language which is Java then we select the version of spring boot at the time of this course the latest stable version is 3.4 .1 there is a newer version but
            • 12:30 - 13:00 that's a snapshot version so it has experimental features that might be removed in the future so make sure to select the latest stable version now under project metadata we have group which is the group or organization that owns this project by convention we use a reverse domain name so example.com becomes com. example now in my case I'm going to change this to code with MH next we have artifact which is the name
            • 13:00 - 13:30 of the project I'm going to change that to store because we're going to build an online store in this course now name is the same so whenever we change artifact name gets updated as well we can leave description as is Now package name is the combination of the group and artifact again we're not going to touch this next we have the package type which can be jar or War we're going to use jar and then we specify the Java version in this course we'll be using Java 23 three next we can select our dependencies
            • 13:30 - 14:00 these are third party libraries or Frameworks we're going to use in our project we'll talk about these later in the section next we go ahead and click generate now this gives us a zip file once you unpack it you can open it with your favorite editor but again I recommend you to use intellig because when using intellig we don't even have to go to this website to create a new spring boot project we can create a project right inside of intellig so open intellig and click new project
            • 14:00 - 14:30 now on the left side under generators select spring boot now what you see on the right side is exactly what you saw earlier on start. spring.io now I need to highlight that this feature is only available in intelligent idea Ultimate Edition if you're using the Community Edition which I don't recommend you won't see this feature the Community Edition is quite Limited in terms of features so if you want to do professional development you should use the ultimate edition so first first we specify our project name I'm going to
            • 14:30 - 15:00 change this to store next we specify the location you can put it anywhere you want on your machine it doesn't matter now optionally we can create a git repository I recommend you to do this so you can properly version your code next we specify our language Java our build tool Maven our group I'm going to change this to com. code with MH we leave artifact and package name as is next we
            • 15:00 - 15:30 specify the jdk version right here we have jdk 23 but what is beautiful about intell is that we can also download the latest version right here so we don't have to go to our browser to download jdk separately from oracle.com okay next we select the Java version I'm going to change this to 23 and click next now up here you can see the version of spring boot that is 3.4.1 optionally we can select our
            • 15:30 - 16:00 dependencies again we're going to leave this for now and come back to it later so let's go ahead and create our first spring boot [Music] project all right now let's talk about our project structure first we have this folder idea that contains a bunch of configuration files used by intellig you never have to touch these then we have mvn this is part of Maven wrapper which
            • 16:00 - 16:30 is a way to run Maven without requiring it to be globally installed on your machine with this we can ensure consistent Maven builds across different environments so we can take this project put it on a different machine and build it with the exact same version of Maven and with this we can prevent surprises let me show you what we have here so inside this folder we have the wrapper folder and in this folder we have a configuration file that specifies the version of Maven we're going to build
            • 16:30 - 17:00 this project with that is 3.3.2 this is different from the maven you have globally install on your machine now once again I want to emphasize if you use intellig you don't need to install Maven globally on your machine because intell comes with Maven built-in okay so this is our configuration file now in this project we also have two Maven rapper files in the rout we have mvnw which is for Mac or Linux and M bw. CMD for Windows both
            • 17:00 - 17:30 of these files are shell scripts so here we have some code that would automatically download the version of Maven specified in this configuration file okay so that's the mvn folder then we have a couple of files for AR gift repositories that's pretty standard we're not going to talk about them in this course we have help. MD which is a markdown file that contains instructions for getting started again we don't care about it next we have palm. XML this is short project object model and this is
            • 17:30 - 18:00 the heart of a maven project so in this file we have some configuration about our project and its dependencies now what you see here is a format called XML which a lot of younger developers are not familiar with it's similar to HTML so here we have open and close tags and in between these tags we have some data so here we have all the attributes we specified at the time of creating our project we have group ID artifact fact ID this is the version of our project
            • 18:00 - 18:30 and so on further down below we have a tag called dependencies which we're going to talk about later in this section so palm. XML is the heart of Maven projects Maven uses this file to download dependencies and build our project now back to our project structure in the source folder we have the actual code for our project we have Main and test in the test folder we write our automated test in the main folder we write the actual code here we
            • 18:30 - 19:00 have two subfolders Java where we have our Java files and resources where we have non-java files like configuration files as well as static assets like HTML CSS JavaScript and so on in the resources folder we have a configuration file called application. properties here we can have one or more key value pairs so here is a key spring. application. name and the value is store in this file
            • 19:00 - 19:30 we can specify the server Port our database settings and so on now here in the Java folder we have a package based on the group and artifact we specified when creating this project in this package we currently have one file store application which is the entry point to our application so here we have a Java class and inside this class we have our familiar main method in this method we have a call to Spring app application.run method so that's the
            • 19:30 - 20:00 basics of our project structure next we're going to talk about dependency [Music] management earlier we talked about dependencies I told you that dependencies are third-party libraries or Frameworks we use in our application for example to build a web application we need an embedded web server like Tomcat we need libraries for handling web requests building apis processing Json data logging and so on now in
            • 20:00 - 20:30 Spring boot applications instead of adding multiple individual libraries we can use a starter dependency which is a curated collection of libraries and Frameworks that are commonly used together they're tested and verified by the spring development team so in this example if you add the starter web dependency it will bring in a compatible version of these libraries let's see this in action so open up your browser and search for maven Central it's right
            • 20:30 - 21:00 here central. sonot type.com now Maven Central is a public repository where we can find dependencies for our projects it's similar to npm for JavaScript pipie for python new get for net and so on now here let's search for spring-boot-starter-web all right here is the first item in the result this dependency or this project is owned by or. spring framework. boot
            • 21:00 - 21:30 now let's click on the dependency name now to use this in our project all we have to do is copy this piece of code in our palom file now this piece of code is dependent on our build tool so up here you can see we have Apache Maven so for Maven projects we have to copy this piece of code but if we use a different build tool like grale then we have to copy a different piece of code okay so back to to Apache Maven now here you can see we have a
            • 21:30 - 22:00 dependency the group ID is org. springf framework. Boot and the artifact is spring boot starter web we also have the version now let's copy this to clipboard back to intellig let's go to our pom file now in this file we have a tag called dependencies where we can list the dependencies of our project this new project that we have created has two dependencies by default one of them is is spring boot starter the other is
            • 22:00 - 22:30 spring boot starter test now after these two dependency tags we're going to paste the piece of code that we just copied now here we have an error on the version because intell cannot find this dependency in our local repository it cannot find in our machine to fix this issue we have to click on this m box up here for synchronizing Maven changes so whenever we added dependency to our project we have to click this icon to
            • 22:30 - 23:00 reload our Maven project and then intellig will download our new dependencies so I'm going to click this now look down here it's resolving this dependencies okay the error is gone so this is one way to add a dependency we go to Maven Central we copy a piece of code add it to our pump file and then reload our Maven project that's one way but there is an easier way first let me remove this new dependency so delete now here we can press command and n on Mac or
            • 23:00 - 23:30 control and n on Windows to bring up the context menu here we select dependency now in this search box we search for spring Das Boot Das starter D web now if this doesn't work on your machine remove and reinstall intellig that will solve the problem okay now here you can see various dependencies that match the search pattern we're going to select this one from or the springf framework. Boot and this is
            • 23:30 - 24:00 spring boot starter web version 3.3.2 let's add this to our project once again we have an error here because this version doesn't exist in our local repository so we click on the maven icon here to reload our project and now intellig downloaded this dependency into our local repository now if you look on the right side we have this Maven panel in this panel we have our project here
            • 24:00 - 24:30 we have a node called repositories so we have two repositories a local repository which is a folder on our machine where these dependencies are stored on Mac it's inside our home folder sl. M2 repository on Windows is probably somewhere like C drive back SL users back SL whatever now we also have a central repository which references Maven Central okay now let's take a look inside the dependencies note So
            • 24:30 - 25:00 currently we have three dependencies in this project this is the dependency that we just added spring boot starter web now earlier I told you that starter dependencies are curated collection of libraries that work together so if you expand this you can see here we have another dependency for working with Json data we'll talk about this in the future we have a dependency for Tomcat which is our embedded web server we have a dependency to Spring
            • 25:00 - 25:30 web and spring web MVC these are used for building web applications with these libraries we can process web requests and build apis now one more thing before we finish this lesson when working with spring boot dependencies as a best practice we should remove the version here and let spring boot manage versioning for us let me explain what I mean so first let's remove the version tag okay now let's go to the top here on
            • 25:30 - 26:00 the top we have this parent tag that references a parent project look at the artifact ID it's spring boot starter parent now if you hold down the command key on Mac or control key on Windows and hover our Mouse over here we can click and go to the P file of this parent project so now we are inside a separate pom file once again here we have a parent tag that references a different
            • 26:00 - 26:30 project that is spring boot dependencies so once again hold down command on Mac or control on Windows and click here so here is the actual parent or grand parent of our project now if you're on Mac press command and F if you're on Windows press control and F and search for spring-boot-starter-web look here we have a dependency to this package and the version that is specified here is
            • 26:30 - 27:00 3.4.1 similarly we have other dependencies and their versions and these are tested to work together so back to our P file using this mechanism we allow the dependencies that we had here inherit their version from this parent project so if they're listed in the parent project that version that is compatible with our project will be used here otherwise Maven will use the latest version of those dependencies now this has two benefits one benefit is that it
            • 27:00 - 27:30 simplifies our pom fight so down here where we specify our dependencies we don't have to include their version the other benefit is that if you upgrade the version of spring boot all dependency versions are automatically updated to their tested compatible counterparts so as a best practice when working with spring boot dependencies we should remove the version and let spring boot manage versions for us [Music]
            • 27:30 - 28:00 in this lesson we'll create our first controller to handle requests to the homepage and serve a simple HTML file but before we start coding let's take a moment to understand the basics of spring MVC which is the foundation of how we handle web requests in Spring boot spring MVC stands for model view controller and it's part of the spring framework that helps us build web applications it provides a clean way to separate different parts of our
            • 28:00 - 28:30 application making it easier to manage and scale model is where our application's data lives it represents the business logic and is usually connected to a database or other data sources in Spring boot the model can be a simple Java class the view is what the user sees it's the HTML CSS or JavaScript that's rendered in the browser in Spring MVC views can be static files or dynamically generated using tools like time Leaf the controller is like a traffic control controller it handles incoming requests
            • 28:30 - 29:00 from the user interacts with the model to get data and then tells the view what to display let's see this in action so back to our project here in the Java folder inside this package let's right click and add a new Java class we're going to call this home controller now intellig is asking if you want to add this to our git repository I'm going to select don't ask again so we don't see this in the future let's go
            • 29:00 - 29:30 ahead and add this to our repository okay now to make this a controller we have to decorate it with the controller annotation so here we type an AD Sign followed by controller and then press enter so this annotation is defined in this package org. springframework do stereotype okay now I believe I covered annotations in my Java course but very briefly an annotation is like a label or a tag that we add in the code to give instructions or additional
            • 29:30 - 30:00 context to the compiler we can apply them to classes methods Fields parameters and so on so in this example by adding this annotation to this class we are telling spring that this class should be used as a web controller for receiving web traffic now inside this class we add a method public string we can call this method anything we want but I'm going to go with index now when we send a request to the root of our website we want this method
            • 30:00 - 30:30 to be called to do that we have to apply another special annotation here that is request mapping now this other annotation is defined in this package or. springf framework. web this is part of the web starter dependency that we added in the previous lesson okay so we add this annotation and then give it an argument that is a URL pattern here we can type a forward slash that represents the root
            • 30:30 - 31:00 of our website so when a request goes to the root of our website this method gets called if you want to receive traffic at a different endpoint like about or contact we can change the argument here okay so let's go back to the root of our website now in this method we return the name of the view that should be returned to the browser so we return index.html okay now we need to create this view back to our project we go to the resources folder this is
            • 31:00 - 31:30 where we add non Java files now here we add a new folder called Static and inside the static folder we add a new file well a new HTML file called index.html now in this HTML file inside the body element we type H1 Tab and and inside the H1 tag we type hello world so
            • 31:30 - 32:00 this is our view now we're not going to cover models in this lesson we'll cover them later in the course next I'm going to show you how to build and run this application hey guys thanks for sticking with me so far just a quick break if you're enjoying this tutorial I wanted to let you know that this is just the first hour of my complete spring boot course the full course has two parts with each part being about 6 hours long it covers a whole lot more taking you from the basics all the way to advanced
            • 32:00 - 32:30 concepts you will learn everything you need to build real world backends with spring boot so after you watched this tutorial if you want to learn more and level up your skills check out the link in the description below and enroll in the complete course now let's jump back [Music] in all right now let's talk about running our application if you're using intellig you can run this application by clicking the play icon on the toolbar look at the shortcut it's contrl and R
            • 32:30 - 33:00 so I'm going to press that our application is built now here on the console window if you scroll to the right you can see that Tomcat which is our embedded web server is initialized with Port 880 so now if you open our browser and navigate to Local Host Port ad8 we can see our homepage beautiful now let me show you a different way way to run this application back to intellig first I'm
            • 33:00 - 33:30 going to stop this now if you're not using intellig you can run this application using Maven first we have to open a terminal window and go to our project folder I've put this project on my desktop inside spring boot SL demo store so right now I'm inside the project folder you can see that in the terminal I'm on the main branch of my git rep repository so if you're run LS on Mac or
            • 33:30 - 34:00 Linux or there on Windows we should be able to see our project files so look earlier we talked about these two files and VNW that is a maven wrapper so if you don't have Maven globally install on your machine you can use the maven wrapper now here on Mac or Linux to run this we have to type period slash mvnw then we type a space followed by- V so as you can see I'm running Maven
            • 34:00 - 34:30 3.9.0 now if you're using Windows you have to type mvnw CMD space- V actually I think CMD is optional but I'm not entirely sure I haven't used windows for over 10 years so excuse me if I'm making a mistake here anyway so now with this Maven wrapper we can run our spring boot application but instead of- V we're going to type spring Das Boot colon run take a
            • 34:30 - 35:00 look Maven compile our application so now once again if we go back to our browser and navigate to this address we should see our homepage you have probably seen this guy before in my other courses his name is John Smith he's our self-proclaimed Rockstar developer who claims he writes bug free code according to John debugging is something other people need to do but let's be real bugs happen to all of us even if you're as perfect as
            • 35:00 - 35:30 John Smith thinks he is so in this lesson I'm going to show you a few different techniques for debugging your spring board applications back to our home controller let's make a few small changes and introduce a bug first let's define a private method that returns a string we call this get view name and here we return index instead of index.html now back our index method first we declare a variable called view
            • 35:30 - 36:00 name and here we call get view name and then we return view name obviously this is unnecessary this code is very redundant but we are deliberately doing this for the purpose of debugging now let's rerun our application so we press contrl and R intellig is saying that this process is running it's asking us if you want to stop and restart the web server let's go ahead all right good back to the browser let's
            • 36:00 - 36:30 refresh all right now we have an error because there is no view called index our view file is index.html so let's see how we can find this book back to our home controller the simplest way to debug this application is using a print statement so before we return the name of the view we can type system. out. printline view name now let's rerun this application okay back to the browser refresh now we
            • 36:30 - 37:00 go back to intellig here on the console window we can see the output of our print statement so we are returning index which is not a valid view name so this is a simple way we can debug our applications but we can also use the debugging Tools in intellig or other IDs to do that first let's remove this print statement all right now we're going to start our application in the debug mode and executed line by line to do that
            • 37:00 - 37:30 first we have to insert a breakpoint in our code a breakpoint is a marker that tells intellig to pause our application when the program reaches that line of code for example here we can add a breakpoint by clicking in the left margin this red dot represents a breakpoint we can click it again to remove it so we insert a breakpoint now we start the application in the debug mode and the execution stops right here here to do that instead of clicking the
            • 37:30 - 38:00 play button we should click the debug button look at the shortcut it's controll and D so I press contrl and D rerun our application in the debug mode okay our web server is listening on Port 880 so now we go back to the browser and refresh this page so our home controller is hit so refresh okay here we are and the execution stopped right here on this highlighted line now this line is not executed yet we can
            • 38:00 - 38:30 execute it line by line using this tool over here step over the shortcut is f8 so if you press f8 this line is executed and now inside this little window we have the variables that are meaningful in the current context so we have this which is a reference to the current object which is home controller we also have view name which is set to index so using this window we can verify that our variables have the right values now if a
            • 38:30 - 39:00 variable is not detected here we can add an expression here for example view name and here's the result okay now we don't need this so let's remove it so this is how we can use step over now we can step over this line as well so we press f8 now we are inside the source code of the spring framework now this is not the actual source code this is the decompiled class but we don't care about this code because this is not part of our
            • 39:00 - 39:30 application we want to debug right so we want to continue execution until something is rendered in the browser to do that we have to use a different tool look at this button this is for resuming program the shortcut on Mac is option command and R so I'm going to press these Keys all right now all the code has been executed and here is the result now back to our home controller let's say we haven't found the bug yet so we want to restart the debugging session again we
            • 39:30 - 40:00 press contrl and D now we go back to the browser and refresh this page so our home controller is hit but this time instead of stepping over this line we're going to step into it maybe there is a problem with this method to do that we use this button over here step into the shortcut is F7 so we press F7 and now we are inside this method here we have only a single
            • 40:00 - 40:30 line of code we could have tens or hundreds of lines of code and this method could call other methods so again we could step over or step into those lines until we would find the source of the problem now in this case we know the problem is with the string literal that we are returning so let's change that to index.html now that we're done we stop the debugger and remove this breakpoint we don't want to leave these break points all over the code because they're
            • 40:30 - 41:00 going to get in the way in future debugging [Music] sessions you have noticed that every time we change our code we have to rebuild our project but in Spring boot we also have the automatic restart feature it's not ideal it's not as fast as automatic restart we have in node or react because there is a little bit of delay but let me show you how to set it up first we have have to go to our pom file now let me show you a cool shortcut
            • 41:00 - 41:30 here we can press shift command and o on Mac or shift control and o on Windows now over here we can search for our files so pal. XML now here we're going to add a dependency to do that we press command and n on Mac or control and n on Windows we select dependency and search for spring-boot das Dev tools okay now look at this dependency
            • 41:30 - 42:00 from org. springf framework. boot so we add this to our project first we remove the version because this dependency is part of the spring framework so it's better to allow the parent element determine the version of this dependency so let's delete this line instead we add another tag called optional and we set it to true that means this is not part of our application code it's not going to be packaged with our application to
            • 42:00 - 42:30 be deployed in the production it's only used during development okay now we have an error because this dependency does not exist in our local Maven repository so we have to click this button to reload our project now Maven downloaded this dependency good now to use this in intellig there are two settings we have to modify we go to the top on intellig IDE menu we go to settings now on Windows I think settings exist under
            • 42:30 - 43:00 file or edit menus okay regardless find the settings page now up here search for compiler now under build execution and deployment here under compiler check this box build project automatically that's the first setting there's one more setting we have to modify here on the top search for advanced settings right here under advanced settings check
            • 43:00 - 43:30 this box allow automake to start even if developed application is currently running so check this box all right now let's reassort our application all right with this in place every time we change our code after a small delay our application gets restarted let's see it in action so let's go back to our home controller and change index.html to index okay now after a few seconds our
            • 43:30 - 44:00 application gets restarted this is not ideal it's not as fast as what we have in environments like node or react it is what it is but I thought to cover it in the course because a lot of people use this tool all right our application got restarted so back in the browser if you refresh we can see the homepage is broken so this is the def tools now I personally am not a fan of this tool so whenever I make changes I like to restart the application using control and R but going forward I'm going to
            • 44:00 - 44:30 check this box so this doesn't get in the way and we can quickly see the result now let's change this to index.html and move on to the next lesson in every application there are settings we'll need to configure like which Port the application runs on database credentials or even custom settings for our application so let's see how we can configure our application properties here in the resources folder
            • 44:30 - 45:00 we have this file application. properties we briefly talked about this before here we have a bunch of key value pairs some of them are standard like spring. application name we have several standard properties like server. Port the default value is 8080 but we can change it to whatever we want and this will be the port our application will listen on I'm going to remove that we can also Al Define custom properties like app dot whatever like page- size
            • 45:00 - 45:30 okay now to use this properties in our code we have to use the value annotation let's see how this works so first we go to our home controller to do that we press shift command and o on Mac or shift control and o on Windows let's go to our home controller okay now in this controller we want to define a private field and initialize it with the value of spring.
            • 45:30 - 46:00 application. name so let's declare a private field private string we can call that app name or whatever now we should annotate this with the value annotation we press enter so it's imported on the top it's defined in this package or. springf framework. beans. factory. annotation okay now as an argument we should pass a string with a special
            • 46:00 - 46:30 syntax first we type a dollar sign and inside braces we type the key of an application property in this case I'm going to copy this key spring. application. name now at runtime spring will get the value associated with this key and injected into our private field so now to see this in action we can use a print statement so
            • 46:30 - 47:00 system.out print line and here we can print the application name okay let's rerun our application and refresh the homepage okay now here on the console look app name is store one of the core features of the spring framework is dependency injection it's a powerful concept that is used in real world applications in this section we'll start by breaking down what
            • 47:00 - 47:30 dependency injection is why it's important and how it helps make your code cleaner and easier to maintain you'll learn how to implement it using Constructors and Setters we'll then dive into how spring boot handles dependency injection using the ioc container you'll see how to configure beans with annotations control which beans are selected when multiple options are available and externalized configurations to make your application more flexible finally will explore Advanced topics like configuring beans
            • 47:30 - 48:00 programmatically using lazy initialization managing Bean Scopes and controlling the life cycle of your beans by the end of this section you'll have a strong understanding of dependency injection and how spring uses it to manage the components of your application efficiently now let's jump in and get [Music] started so what is dependency injection many students find this concept confusing or complex but it's actually very simple let's break it down with a
            • 48:00 - 48:30 real word example imagine we're building an e-commerce application we have an order service class that handles placing orders when an order is placed the customer's payment needs to be processed so order service depends on a payment service like stripe payment service in this case we say order service is dependent on or coupled to strip payment service at first glance this might seem fine but let's talk about the issues that arise when one class is tightly
            • 48:30 - 49:00 coupled or dependent on another the first problem is that order service can only use stripe payment service if tomorrow we decide to switch to a different payment provider like PayPal we would have to modify the order service code and once we change the order service class it has to be recompiled and retested which could impact other classes that depend on order service the second problem is that we cannot test order service in isolation because order service is tightly coupled to strip payment service
            • 49:00 - 49:30 we can test its logic separately from strip payment service now the problem here isn't that order service depends on strip payment service dependencies are normal in any application the issue we have here is about how the dependency is created and managed let me give you an analogy think of a restaurant a restaurant business needs a chef right so there is a dependency between the restaurant and the chef if the current Chef becomes unavailable available the restaurant can hire another Chef this kind of dependency is totally normal but
            • 49:30 - 50:00 what if we replace chef with John that means our restaurant is now dependent on Jon a specific Chef what if Jon becomes unavailable we can't replace him with someone else and the restaurant will be in trouble this is an example of tight or bad coupling now back to our e-commerce application we don't want order service to be tightly coupled to a specific payment service like stripe that's like a restaurant being dependent on a specific Chef instead we want order service to depend on a payment service
            • 50:00 - 50:30 which could be stripe PayPal or any other provider to achieve this we can use an interface to decouple order service from strip payment service an interface in Java is like a contract that defines the capabilities of a class it doesn't contain any implementation or logic it simply lists the methods or capabilities a class should have for example if order service depends on a payment service interface it doesn't know anything about stripe PayPal or any other payment provider as
            • 50:30 - 51:00 long as these providers implement the payment service interface they can be used to handle payments and Order service wouldn't care which one is being used so here are the benefits if you replace strip payment service with Paypal payment service the order service class is not affected we don't need to modify or recompile order service also we can test order service in isolation without relying on a specific payment provider like stripee now with this setup we just have to give order service
            • 51:00 - 51:30 a particular implementation of payment service this is called dependency injection meaning we'll have to inject a dependency into a class just like how we can inject a drug into a body we can also inject an object into a class now there are a few different ways we can do this and we're going to cover them over the next few lessons but first let's jump into the code and set up our example all right back to our project here in this package let's add a new
            • 51:30 - 52:00 class we're going to call this order service now let's give it a method public void place order now in a real application we should pass an order object here but let's keep things simple and focus on dependency injection so no parameters now here we need to use a payment service like stripe so first we go back to our project and and add another class here stripe payment
            • 52:00 - 52:30 service now in this class we add a method public void process payment now in a real application we should pass a payment object here that encapsulates payment information like credit card details but again to keep things simple let's just add a simple parameter like a double here double amount now in this method let's add a print statement let's change the message to
            • 52:30 - 53:00 amount we just print the amount and right above that we add another print statement and say stripe now in the future we can create another payment service like PayPal and in that class we'll print PayPal okay now our order service needs to use strip payment service so back to this method here we declare variable payment service and set it to a
            • 53:00 - 53:30 new instance of stripe payment service then we call payment service process payment that's hardcode a value like $10 okay now this is our earlier setup before we introduce an interface to decouple these two classes so in this implementation the order service class is dependent or tightly coupled to stripe payment service so that means we
            • 53:30 - 54:00 cannot test order service in isolation because whenever we want to test that we have to bring in strip payment service and also if in the future we decide to switch to a different provider like PayPal we'll have to modify the order service class as a result of this the class has to be recompiled retested and this can propagate to several other classes in our application so this is where we use an interface to decouple or order service from stripe payment service to do that we go back to our
            • 54:00 - 54:30 stripe payment service on the top under the refactor menu go to extract and then interface now on this dialog box first we specify our interface name we're going to use a more General name so we remove stripe and just call this payment service we leave it in the same package and then down here we select the method that we want to include in the interface by default it's not selected so make sure to select it and then click
            • 54:30 - 55:00 refactor now intellig is saying that this interface has been successfully created it's asking if you want to proceed yes and then it says use interface where possible this is called programming against interfaces okay let's go ahead look what happened now strip payment service implements payment service let's take a look here so we hold down command on Mac or control on Windows and click here this is our
            • 55:00 - 55:30 interface as you can see this interface has no implementation there is no logic here no algorithm all we have is a method declaration or a capability this is like a chef that can cook but how they cook we don't know that is dependent on the implementation okay now with this setup we have to modify order service so instead of being coupled to strip payment service it should be coupled to payment service we'll do that
            • 55:30 - 56:00 next one way and the recommended way to inject a dependency into a class is via Constructor so here in the order service let's define a Constructor public order service we press tab to complete the code now we should pass our dependency as an argument to this Constructor so first we give it a parameter of type payment service we press Tab and tab
            • 56:00 - 56:30 again so we receive a payment service object here now we should store this in a field in this class so we can use it in the place order method so we can declare a private field private payment service Tab and then initialize it in the Constructor intellig automatically detected the code we want to write so we can just press Tab and here it is so when creating an order service we pass a payment service object we store it in a
            • 56:30 - 57:00 field in this class which is declared up here and then in the place order method instead of using strip payment service we use the payment service object that we have in this class this is our setup now to see this in action we should go back to our project and go to the store application class we're going to take a break from spring so we're going to comment out this line so instead of running a spring application we're going to run a console application so here in
            • 57:00 - 57:30 the main method first we declare a variable called order service then we set it to a new order service now here in the Constructor we have to pass a payment service this is our chance to inject a dependency into the order service class so we can pass a new strip payment service or in the future we can pass a different payment service like PayPal okay now we can call order service place
            • 57:30 - 58:00 order let's run our application all right look we are using stripe to process $10 now let's create a new payment service so in this package we add a new Java class called Paypal payment service now here we say this class implements payment service so we press tab to complete the code now we have an error because this class is not
            • 58:00 - 58:30 implementing the methods declared in this interface so we can press alt and enter and here we select Implement methods in this dialog box we can see all the methods declared in our payment service interface by default this is selected otherwise we have to select it and then we click okay so here's our implementation now to save time I'm going to go back to our stripe payment service copy these two lines and paste
            • 58:30 - 59:00 them in our PayPal class we just have to change stripe to PayPal okay now with this change we can go back to our store application and when creating a new order service we can give it a new PayPal payment service now if you run the application we can see that PayPal was used to process $10 but here's the interesting part as a result of supporting PayPal payments we didn't have to modify our order service so we
            • 59:00 - 59:30 extended our application by creating new classes instead of modifying existing ones in object-oriented programming this is called open closed principle it's a very important principle in building maintainable software the open close principle says that a class should be open for extension but closed from modification in other words we should be able to add new functionality to a class without changing its existing code now why is this important because by
            • 59:30 - 60:00 avoiding changes to existing code we can reduce the risk of introducing bugs and breaking other parts of the application now of course this is just a guideline it doesn't mean we need to blindly apply it everywhere in our application like any principle it's something we should strive for when it makes sense and adds value now you might have seen people like our famous Rockstar developer Mr John Smith who hate object-oriented programming one reason might be that they read principles like the open close principle in a book applied them blindly
            • 60:00 - 60:30 to every corner of their application and ended up with an over engineered mess and of course instead of blaming their own misuse of the principles they blame object-oriented programming itself the takeaway here is that principles like the open close principles are tools not rules they're meant to guide you in building flexible and maintainable software but you should always use them with common sense [Music]
            • 60:30 - 61:00 another way to inject a dependency into a class is via a Setter so here in the order service class we're going to define a Setter for setting the payment service now we can type that Setter by hand or we can have intelligate generated for us first we put the cursor on the field name then we press command and n on Mac or control and n on Windows to bring up the generate context menu here we select Setter enter and proceed all right
            • 61:00 - 61:30 here's our new Setter so this Setter gets a payment service and sets the payment service field in this class now I don't like that intellig inserts the generated code on the top because by convention we put Getters and Setters in the bottom so let me show you another cool shortcut for moving this code first we put the cursor on the method Declaration on the first line now we hold hold down shift and command on Mac or shift and control on Windows Now by
            • 61:30 - 62:00 pressing the down or up arrows we can move this method around okay I'm going to move it to the bottom so here it is now to use this we go back to our store application here we call order service do set payment service and pass new Paypal payment service now of course this looks a little bit ugly because we don't want to pass the payment service twice so it would be better to remove the payment service from
            • 62:00 - 62:30 Constructor and then pass it to the setter so back to our order service we can remove or comment out this Constructor the shortcut to do that is command and slash on Mac or control and slash on Windows okay now back to our store application we create an order service we set the payment service and then then place the order now there's a problem with this code can you tell here's the
            • 62:30 - 63:00 problem what if we forget to set the payment service now if you run our application it crashes we have a null pointer exception so we should use this approach for optional dependencies in other words our order service should be able to do its job without having that external dependency in this case a payment service is not an optional dependency it's a required dependency so it doesn't make sense to injected bya Setter again for the most part Constructor injection is the more common
            • 63:00 - 63:30 and the recommended way to inject dependencies so far we have been manually creating a payment service and passing it to order service while this works for simple examples it quickly becomes a headache as our application grows what if Paypal payment service has its own dependencies we would have to create more objects and wire them together managing all of this manually
            • 63:30 - 64:00 can get messy tedious and aror prone this is where spring comes to the rescue one of the core features of the spring framework is its ability to create objects and inject them into our classes automatically at the core of the spring framework we have what we call an ioc container we'll talk about ioc in a minute but this container is responsible for managing the objects in our application in Spring terminology we refer to this manage object objects as beans so a bean is just a regular Java object that is managed by a spring
            • 64:00 - 64:30 spring takes care of creating it injecting its dependencies and even managing its life cycle now what is ioc about well ioc is short for inversion of control the name comes from the fact that it inverts the control of creating objects and managing dependencies in a traditional application we are in control we write the code to create objects and manage dependencies but with the ioc container we hand over that control to Spring let's see this in action so I'm going to bring back this
            • 64:30 - 65:00 line now this run method returns an object of type application context application context is our ioc container it's a storage for our objects so we can store the result in an object of type application context that is defined in this package or. springframework doc context so we import it and call this object context now this context has a method called get bean with this method
            • 65:00 - 65:30 we can get a bean or an object that is managed by a spring in this case we need a being of type order service right so as an argument we pass order service do class okay then we store the result in order service so instead of us manually creating objects and injecting tencies we let spring take care of that for us so let's remove this
            • 65:30 - 66:00 line okay now let's run our application all right our application crashed with an exception of type no such being definition exception the message says no qualifying being of type order service available in other words spring doesn't know how to create an instance of order service there are two ways we can solve this issue we'll talk about about them [Music]
            • 66:00 - 66:30 next there are two ways we can tell spring about objects it should manage for us one way is using annotations and that's what we're going to cover in this lesson there is another way using Code which we'll look at later in this section so back to our main method look here we need to get a be of type order service so we want spring to manage objects of type order service to do that we go to our order service class and annotate this with an annotation called
            • 66:30 - 67:00 component this is defined in org. springf framework. stereotype so let's press enter so this is imported on the top okay so with the component annotation we tell spring to manage objects of type order service now component is a general purpose annotation we have other specialized annotations like service for classes that contain business logic we have repository for classes that interact with the database we have another
            • 67:00 - 67:30 annotation that you have seen before and that's controller this is used for markting classes as controllers for handling web requests so back to our code order service is a service class so here we can also use the service annotation now technically service is just an alias for the component so there's really no difference between the two let me show you what I mean so hold down command on Mac or control on Windows and click service look at the implementation look
            • 67:30 - 68:00 service is an alias4 component so we can use either of these annotations but the component annotation is often used for utility classes we use service for classes that contain business logic now look down here we have an error saying could not autowire no beans of payment service type found what this error is saying is that order service needs a payment service but payment service is an interface so spring doesn't know how to create instances of the payment
            • 68:00 - 68:30 service interface to solve this problem we have to go to the Paypal payment service class and annotate this with either component or service now technically we should do the same with the stripe payment service but don't do that in this lesson because that's going to cause an issue that we'll talk about later in this section okay so we simply annotated two classes with service now if you run our application we can see that PayPal was
            • 68:30 - 69:00 used to process $10 beautiful now there is another annotation you need to be familiar with and that is autowired let's go back to our order service class so here we have a Constructor that takes a payment service now in the past we had to annotate this Constructor with autowired to tell spring to autowire this object with its dependencies but going forward this is not necessary if our class has a single Constructor so in this case we can
            • 69:00 - 69:30 comment this out and everything works but you might see The autowired annotation in a lot of older code bases now if you have multiple Constructors here we have to use autowired let me show you this in action so I'm going to temporarily comment this out now let's create a default Constructor order service now if you run our application our application crashes with a null pointer exception because in this example spring prefers to use the
            • 69:30 - 70:00 default Constructor with no arguments and as a result payment service will remain uninitialized to solve this problem we have to bring back The autowired annotation now when we run our application everything works as expected because we have told spring to autowire this class with its dependencies okay now what if we have another Constructor but not a default Constructor so let's add payment service here and give it a
            • 70:00 - 70:30 second parameter like int X it doesn't really matter now look what happens if you remove the auto annotation right away we can see an error here saying class doesn't contain matching Constructor for auto wirring but let's run the application and see the error we get because that's a very common error in Spring applications so let's run this one more time all right now we got an exception of type Bean creation exception and the
            • 70:30 - 71:00 message is error creating Bean with the name order service this is a very common exception so to solve this issue again we have to bring autowire back so bring Auto wires this class with its dependencies let's run our application one more time problem is solved so let's remove this other Constructor as well as the autowire out ation and move on to the next lesson if you found this useful imagine
            • 71:00 - 71:30 what you will learn in my full spring wood course as I said the full course has two parts but each part about 6 hours long it covers a whole lot more and is packed with exercises to make you a job ready developer click the link below and start learning today