Introduction to Spring Boot
The course is part of this learning path
In this course, we will learn the concepts of microservice and spring framework with a focus on Spring Boot.
- Understanding Spring Boot
- Beginner Java developers
- Java developers interested in learning how to Build and Deploy RESTful Web Services
- Java Developers who want to develop web applications using the Spring framework
- Java Developers who want to develop web applications with microservices
- Java Developers who wish to develop Spring Boot Microservices with Spring Cloud
- Basic Java knowledge
Hello, dear friends. In this video, we will start learning about Spring Boot. We'll try to address the question, what is Spring and Spring Boot?
Let's get started. Let's start with the Spring Framework. Spring started as a lightweight alternative to Java Enterprise Edition, rather than develop components as heavyweight Enterprise Java Beans, EJBs. Spring offered a simpler approach to enterprise Java development, utilizing dependency injection and aspect oriented programming, to achieve the capabilities of EJB, with plain old Java objects POJOs. But while Spring was lightweight in terms of component code, it was heavyweight in terms of configuration. Initially, Spring was configured with XML. Spring 2.5, introduced annotation based component scanning, which eliminated a great deal of explicit XML configuration for an application's own components. And Spring 3.0, introduced a Java-based configuration, as a type-safe and re-factorable option to XML. Even so, enabling certain spring features such as transaction management and spring mvc, required explicit configuration; either an XML or Java. Configuring servlets and filters such as spring dispatcher servlet, required explicit configuration in web.xml or in a servlet initializer.
Component scanning reduce configuration and Java configuration made it less awkward, but spring still required a lot of configuration. Any time spent writing configuration, is time spent not writing application logic. The mental shift required to think about configuring a spring feature, distracts from solving the business problem. Like any framework, Spring does a lot for you, but it demands that you do a lot for it in return. Moreover, project dependency management is a thankless task. Deciding what libraries need to be part of the project build is tricky enough, but it's even more challenging to know which versions of those libraries will play well with others. When you're adding dependencies to your build, you're not writing application code. Any incompatibilities that come from selecting the wrong versions of those dependencies, can be a big headache. Spring boot has changed all of that. Suppose you're given the task of developing a very simple "Hello World" web application with Spring. What would you need to do? I could think of things you need at a basic level. A project structure, complete with a maven or great old build file, including required dependencies. At the very least, you'll need Spring NBC and the several API expressed as dependencies. A web.xml file or web application initializer implementation, that declares springs dispatcher servlet. A spring configuration that enables spring MVC.
A controller class that will respond to HTTP requests with "Hello World". A web application server, such as tomcat, to deploy the application to. What's most striking about this list, is that only one item is specific to developing the "Hello World" functionality; The controller. The rest of it is generic boilerplate, that you need for any Web application developed with spring. Spring boot is a project that is built on top of the Spring framework. It provides an easier and faster way to set up configure, and run both simple and web-based based applications. It is a spring module that provides the spring framework; the rapid application development, RAD functionality. It is used to build standalone applications, that you can simply run because they require very little spring configuration. As you can see in this image, Spring Boot is the combination of the Spring framework and embedded servers. The spring framework has gained the interest of the Java developer community, as a lightweight alternative to EJB and has become one of the most popular application development frameworks. It consists of a large number of modules providing a range of services, including a component container, ASP support, security framework, data access framework, Web application framework, support classes for testing components, etc.
Collecting all the required spring components together, setting up library dependencies in grade school or maven, and then configuring the required spring beans using XML annotations or Java code, requires quite an effort withn the spring framework. So, that's where the importance of the spring boot project is revealed here. Spring boot is already can-be-started app. Depending on what spring launcher class you extend, it might be a CLI app or a web app. To add extra features to the app, Simply add dependencies to the project. And that's all I have to say about spring. We will look at spring properties with examples in the following videos. Until then, take care.
OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.