Home Spring
Post
Cancel

Spring

Spring intro

This is just to give you a solid foundation of Spring and we had to start with some high-level concepts.

logo

Here are the Spring docs

Spring with Spring Boot

Whether you are writing internet applications or enterprise applications targeting the JVM, there is no question that Spring is the premier framework for doing this type of work.

  • Spring offers a rich set of abstractions that allow developers to focus on the business needs and not on the needs of the infrastructure or your integrations. This gives developers speed to market, as well as the ability to quickly iterate on functionality.

The power of Spring doesn’t stop there. It continues with a robust community filled with knowledgeable and friendly developers that are more than willing to offer insights to those still learning or seasoned veterans that are stuck. And we all get stuck.

Spring is, by far, the most popular framework for application development in the Java ecosystem. By a wide margin. The reason is actually quite simple – it does a lot of things right, and it’s getting better and better with each release.

There aren’t a lot of technologies with the kind of wide reach, stability and maturity of Spring, that still move fast and innovate.

There are expensive training courses available, like this one:

Learn Spring 5 and Spring Boot 2

I have learned everything I know about Spring without spending money, but it might be your cup of tea to actually follow a course, the option is there, and the choice is yours. But you can truly learn everything by the available resources on the internet itself.


The Spring framework is built and designed such that it provides comprehensive support for developing applications for the JVM, including abstractions for some of the most powerful and common enterprise systems integrations, specifically around common infrastructure.

Spring essentially is designed to provide the plumbing for using these enterprise offerings and common components used in both internet and enterprise application development. This plumbing allows you to easily consume these offerings while focusing on your business logic, instead of the copy paste scaffolding code to use these integrations that many developers rely on.

Spring is designed using solid Object Oriented Programming practices and its style promotes you to do the same thing when consuming the framework. Things like coding to an interface, instead of an implementation are paramount in Spring.

The plumbing idea: Spring promotes Don’t Repeat Yourself or DRY principles by leveraging the powerful abstractions of the framework instead of rebuilding the scaffolding over and over again, you reduce your risk of copy paste errors, and instead focus on the actual needs of your application.


Some definitions and how they are utilized when talking about Spring.

  1. POJO or Plain old Java Object.

    In Spring, this is any class file that contains both attributes and methods. And those methods are not just getters and setters.

  2. Java Beans. These two are POJOs in practice, but they’re only methods are accessor methods, often called getters and setters.
  3. Spring Beans, are POJOs that are configured and managed by the application context.
  4. DTOs, or Data Transfer Objects are Java Beans with the specific purpose of moving state between logical layers of your application.

There are times when you don’t want to expose the details of your working classes and instead translate to a DTO, which often is written as an immutable object before setting the state data out of the logical layer.


Inversion of Control

Inversion of Control is a central pattern to the Spring framework and much of Spring is built around the central design pattern. It can be said that if you fully understand how Spring utilizes IoC, you understand Spring fully.

Inversion of Control provides a mechanism for dependency injection, however, it’s more than just dependency injection because with Spring’s use of Inversion of Control, the framework itself controls all operations of the lifecycle of those dependencies, not just the injection.


The Application Context

The Application Context wraps the Bean Factory, which is the Inversion of Control container itself. The Bean Factory serves the Beans during runtime of your application.

  • We, as users and developers, never really interact with the IoC container itself. Instead we interact with its wrapper or the application context.

One of the most powerful aspects of Spring Boot is that it provides auto-configuration of the application context so that you, as the developer, can leverage simple properties and conventions to configure the Beans loaded into the Bean Factory and used by the IoC container.


Start daily exercises in the Code Gym

Start with: Start your journey to become a Java Developer

Continue with: Spring Framework

This post is licensed under CC BY 4.0 by the author.