• 15 heures
  • Moyenne

Ce cours est visible gratuitement en ligne.

course.header.alt.is_video

course.header.alt.is_certifying

J'ai tout compris !

Mis à jour le 03/07/2020

Compare the advantages of Spring Boot vs Spring

If you are reading this, it means you are already interested in or at least curious about Spring or Spring Boot. But what is this Spring or Spring Boot that everyone’s talking about? Let’s find out!

What is Spring?

When building Java applications before, you had to follow complex specifications set out by Java 2 Enterprise Edition (J2EE). You needed a framework to combat all this complexity - so Spring was born in 2004! Over time, it has grown from a relatively small framework to a family of more than 20 projects that provide solutions for common challenges that come up when developing modern enterprise applications.

It soon became the most popular framework for developing Java enterprise applications because of its relative simplicity, its versatile programming model, and its quality performance in the production environment. Here are some more specific reasons to use Spring:

  • Modular architecture

    With Spring, it’s not all or nothing! You can pick and choose whatever you want, and leave the rest out. This helps keep your Spring application lightweight.

  • Testability

    Spring promotes loosely coupled components, which is an essential factor for testability of an application. It also provides many helper test classes which make unit testing Spring applications significantly easier.

  • Boilerplate code reduction

    Boilerplate refers to sections of code that you find yourself copy/pasting in many places with little or no change. Spring reduces boilerplate code in many areas like transaction management and security.

  •  Well-designed web framework

    Spring Web MVC is a powerful and flexible web framework. You can use any template engine for generations of HTML pages. It’s easily testable, and it makes it simple to factor out common behaviors when processing different requests - something that allows you to reduce code duplication.

What is Spring Boot?

While Spring was a significant step forward in terms of simplicity compared to J2EE, creating a new Spring project or adding new technologies to an existing one was never an easy task as it required a lot of manual configuration. Spring Boot was introduced to address this issue and is built on top of Spring. Following the convention over configuration (CoC) principle, it removes the need for manual configuration unless it is absolutely necessary. So in a nutshell, you can think of Spring Boot as Spring simplifier.

The power and flexibility of a popular framework like Spring combined with a simplicity that used to be exclusive to smaller and simpler frameworks is an irresistible combination in and of itself. But it's not the only thing Spring Boot has to offer. Here are some of the other benefits:

  • Embedded Servlet container
    The traditional way of doing web applications in Java has been to package the code in a single file and then deploy it to an HTTP server that you had previously installed and configured. Well, those days are gone! You can package your Spring Boot web application as a normal .jar file with an embedded web server. Your application can be run by itself just like a normal runnable JAR. This feature has made Spring Boot the number one choice for developing microservices, as each service needs to be self-sufficient and stand alone.

  • Ready for production
    Normally, when you are done with developing all the business functionalities of an enterprise application, you also need to implement another set of features to make sure your application is manageable and maintainable in a production environment. For example, you want to be able to check if the server is up and running or to see what the average response time for incoming requests is. With Spring Boot, you get all of these features out of the box as freebies, so you no longer need to worry about implementing them. 😎

Okay, I get that Spring Boot is a great tool. But am I going to just read about it? 

Yeah, it’s cool to read and learn about all the features of Spring, but programming is like swimming - you never get good at it by just reading about it. You need to jump in! That's why in this course we will build and complete a web application together called Watchlist.

https://stock.adobe.com/images/young-asian-man-reading-book-by-the-pool-on-a-sunny-summer-day/198687306
The way to be a good reader, not a swimmer!

Introducing...the Watchlist application!

The Watchlist app has come out of the mind of Tom, our client. He wants to be the next Mark Zuckerberg, and he has an ambitious idea to back it up! He wants to create an application to help movie fans choose the next movie they want to watch. 🎬 With this app, they can keep track of what they potentially want to watch, rank their priority, and leave any notes (“the trailer was super cool,” “my boss recommended,” “won 7 Oscars,” etc.). The user should also be able to run and use the app anytime from any device, which makes it a perfect fit for a web app. After talking with Tom, we've determined that the first version of the app should have at least these three pages:

  • Watchlist page
    This is where the user can see the list of movies they have added. For each movie, you see a title, a priority, a line of comment, and an action button to mark a movie as seen.

  • Add movie page
    This is a page where the user enters the details of a movie he or she would like to watch at some point in the future. The user enters the title, a priority, and a personal note about the movie.

  • Homepage
    This is a simple page with a welcome message and two hyperlinks that would take the user to one of the pages mentioned above.

To help focus on creating a dynamic web application using Spring Boot and Spring Web MVC, we will base our work on the static website version of our app, then make it dynamic. Feel free to check out the static pages on this repository on GitHub.

Okay! Tom is already daydreaming about his yacht, so let’s make it happen!

https://stock.adobe.com/search?filters%5Bcontent_type%3Aphoto%5D=1&filters%5Bcontent_type%3Aillustration%5D=1&filters%5Bcontent_type%3Azip_vector%5D=1&filters%5Bcontent_type%3Avideo%5D=1&filters%5Bcontent_type%3Atemplate%5D=1&filters%5Bcontent_type%3A3d%5
Let's help Tom get here!

Let's recap!

  • Spring was created to simplify the creation of enterprise web applications. 

  • Spring has many advantages, including:

    • Modular architecture

    • Testability

    • Boilerplate code reduction

    • Well-designed web framework

  • Spring Boot simplifies Spring further by using the convention over configuration principle. 

  • Spring Boot advantages also include:

    • An embedded web servlet

    • Features for ensuring your application is manageable and maintainable in a production environment

 Now, in the next chapter, we'll create our first Spring boot project and get things rolling! See you there! 

Exemple de certificat de réussite
Exemple de certificat de réussite