Getting started with Spring (Boot)

If you’re looking to get started with the Spring framework, you’re in the right place. In this article, we will give you an introduction to Spring Boot and the underlying Spring Core Framework, and explain why so many developers use Spring. We also list some resources that can help you learn all about Spring (Boot).

What is the Spring Framework and how does it work?

The Spring Framework (also referred to as Spring Core) is a lightweight development framework that helps developers create modern (Cloud Native) applications. Often seen as an alternative for JEE, it offers a set of best practices to make development quicker, easier & safer without sacrificing power. Since Spring leverages Interfaces and open standards, it is also very extensible. The release of Spring Boot in 2014 was a huge next step in extending the Spring Framework with a set of structures and tools for creating microservice architectures.

Spring enables a POJO-based programming model. POJO stands for “Plain Old Java Object” and is not bound by any special restriction other than those forced by the Java Language Specification, and does not require any classpath. This model will make your code easier to read, allowing you to be more productive.

Spring is well-known for the implementation of the Inversion of Control principle, also known as dependency injection (DI). With dependency injection, the Spring container injects objects into other objects or dependencies. The Spring framework documentation describes the process as follows: “Dependency injection is a process whereby objects define their dependencies (that is, the other objects they work with) only through constructor arguments, arguments to a factory method, or properties that are set on the object instance after it is constructed or returned from a factory method. The container then injects those dependencies when it creates the bean.” This process is fundamentally the inverse (hence the name, Inversion of Control) of the bean itself controlling the instantiation or location of its dependencies by using direct construction of classes or a mechanism such as the Service Locator pattern.

What is the Spring Framework used for?

The Spring ecosystem can be used to develop a wide range of projects and do all sorts of things. We list a number of possibilities below.

Developing web applications

Since Spring is a lightweight application development framework, it’s no surprise that it’s often used to develop web applications. Spring MVC is often considered as the de-facto framework for java web applications development nowadays because of the many handy functionalities it offers.

Securing web applications

You can choose to implement Spring Security in your projects to protect the web applications you’re building. Spring Security can be used to provide both authentication and authorization to Java applications.

Handling long running jobs

Some database queries could take hours to finish, but you don’t want to keep your user waiting. With Spring Batch, you do not only have functions available that are essential in processing large volumes of records, but you can also keep the user updated on the status of the job.

Handling external resources

By using Spring Integration, you can integrate external systems via declarative adapters within Spring-based applications.

For standalone Java projects

Spring containers can be run stand-alone with Spring Boot, which makes it easy to create production-grade Spring based applications.

What is the difference between Spring and Spring Boot?

Many people use the terms Spring and Spring Boot interchangeably, while they are actually not the same thing. The word Spring refers to the Spring Framework as a whole, namely a comprehensive infrastructure for developing Java applications.

Spring Boot is actually more of an extension of the Spring framework. While the Spring framework focuses on providing flexibility, Spring Boot aims to shorten the code length and allows you to build a stand-alone application with minimal or zero configurations. It does that by eliminating the boilerplate configurations needed for setting up a Spring application. Spring boot is widely used to develop REST APIs, whereas the Spring Framework is mostly used for building applications. You can read more about Spring Boot in Spring’s documentation.

Why is the Spring Framework that popular?

Before the Spring Framework launched, Java applications were developed using JEE standards. With these standards, applications could be deployed on a JEE application server, but there were some problems. As the application progressed, the code tended to become rather complicated, affecting system performance because the applications became very heavy. The introduction of the Spring Framework solved these issues.

Another important reason why the Spring Framework became so popular is because developers find it easy to use. Spring has multiple configuration options, making it easy for developers to start and configure exactly what they need. Since Spring is modular, this gives developers the option to use the entire Spring Framework, or just certain modules they need.

Moreover, the Spring Framework is open source and has a large, helpful community (which you can find on Stack Overflow and Gitter). No matter if you’re an absolute beginner or a seasoned pro, Spring’s community allows you to find the support and resources you need to get you to the next level. This big community has helped Spring to grow and become more popular over time.

As an experienced Spring trainer, our VCI (VMware Certified Instructor) Patrick Hancke has good knowledge of the Spring Framework. He discusses some further advantages of the Spring Framework in his blog post.

Are there any prerequisites to get started with Spring?

There are a few things you should know before you dive into the world of Spring. First of all, since the Spring Framework is based on Java, you should have good knowledge of Java before getting started. You should be comfortable with writing Java code, and have a good understanding of at least one popular IDE such as EclipseApache NetBeans or IntelliJ. These are the most vital prerequisites for getting started with Spring.

There are a few additional subjects you could look into before getting started with Spring in order to make your journey easier:

  • Databases, more particularly MySQL. This is especially useful if you’re developing an application which needs to persist data into a data warehouse or needs to propagate data to a third party database.
  • Web-technologies such as HTML, CSS, and JavaScript to build websites and user interfaces. You can find many online tutorials and courses, but if you prefer to have trainer support, we offer a course on HTML, CSS and JavaScript as well.
  • Gain some knowledge on JEE and JSE-related technologies such as servlets and Java Database Connectivity (JDBC).
  • Learn more about the MVC pattern. This will be especially useful when you’re designing an application on the front-end.

The best way to learn is by getting your hands dirty, though. Don’t get lost in theory and start practicing as soon as you feel comfortable enough to do so. Spring’s official website offers many getting started guides with coding examples to get you started.

What is the best way to start learning Spring?

There are many ways to get started with learning the Spring Framework, and there is no right or wrong way to learn Spring. Where you should start, will mostly depend on your personal preferences. We list a number or available resources below.

Official resources by Spring

Spring has a learn section on their website that offers a quickstart guide, lots of other getting started guides, topical guides and tutorials. They all offer extensive explanations and coding examples to help you get familiar with Spring. There’s also extensive documentation available on the Spring framework.

Spring Community

Should you run into a particular issue that you can’t solve yourself, you can rely on Spring’s huge community to help you solve the problem. You can find the Spring community on Stack OverflowGitHub and Gitter.

Spring also organises a number of events, where you can find the most active users of the Spring community. The events offer experienced speakers on multiple Spring-related subjects, and they’re a great opportunity to collaborate and socialise with other members of the Spring community. Some examples are SpringOne and Spring I/O. Some of our Spring trainers have attended Spring I/O Barcelona before, you can read about their experiences in this blog post.

Training & certification

If you’re not comfortable with learning about the Spring Framework on your own, you can consider enrolling for a training with an official VMWare Tanzu training partner like The Campus. Each course is delivered by an experienced VCI (VMware Certified Instructor) and will equip you with the skills you need to be a successful Spring practitioner in your chosen discipline. The course will also prepare you for the official certification exam, which can be quite challenging. Luckily, our trainer Kristof Van Sever wrote a blog post on how to prepare for the exam.

Are you ready to dive into the world of Spring? Our Spring Core course is a great place to start! During this 4-day course, you will gain hands-on experience with Spring’s major features, including configuration, data access, REST, AOP, auto-configuration, actuator, security, and Spring testing framework to build enterprise and microservices applications. Read more about this course and discover available dates here.

The Campus, Charlotte Van Rompaey 17 March, 2021
Share this post

Interviews with our VCIs: Kristof Van Sever