What is Spring Boot? Features & Architecture

Sep 18, 2022
100 views
Spring Boot is an extended version of Spring Framework. It is an open-source framework that provides Rapid Application Development. It is developed by Pivotal Team. Spring Boot is used to build standalone and production-ready spring applications.

What is Spring Boot?

Spring Boot is a Spring framework module that provides the RAD feature to the Spring Framework. It is dependent on the starter templates (collection of all the significant transitive dependencies) feature, which works perfectly. Spring Boot provides a platform for Java developers to develop a standalone and production-grade Spring application. It can run both core projects and web-based applications.

It is designed with the following goals:

  • It avoids XML configuration.
  • It provides the facility to run applications independently.
  • It takes less time to develop an application.
  • It develops the production-ready Spring application in an easy way.

Spring Boot Features

There are following features of Spring Boot:

  • Auto-configuration: Auto-configuration classes are bundled in external jars that can be picked up by Spring Boot. It sets up your application based on the surrounding environment. It is associated with a "starter" that provides the auto-configuration.
  • Properties file: It provides a rich set of the Application Properties file. We can use these properties file in our project. The properties file is used to set properties.
  • Externalized Configuration: Spring Boot provides the functionality to externalize your configuration. We can work with the same application code in different environments. We can use properties files, YAML files, environment variables, and command-line arguments to externalize configuration.
  • Logging: Spring Boot uses Commons Logging for all internal logging but leaves the essential log implementation open. Default configurations are provided for Java Util Logging and Logback. In every case, loggers are pre-configured to use console output with optional file output also available. By default, Logback is used for logging.
  • Profiles: Profiles provide a way to isolate a part of our application and make it available only in certain environments. We can use spring.profiles.active property that specifies the active profile. It means that you can specify active profiles in application.properties.
  • YAML Support: YAML is a superset of JSON. It provides an appropriate way of specifying a hierarchical configuration. The SpringApplication class automatically supports YAML.
  • Type-safe Support: It governs and validates the configuration of applications. Application Configuration is an important task that must be type-safe.
  • Security: It is secure with basic authentication on all endpoints.
  • Standalone: It is fully standalone. We don’t need to deploy our application to a web server or any special environment.
  • Opinionated: The framework chooses how to do things for itself.

Spring Boot prerequisites and requirements

Prerequisites for Spring Boot Application

Our Spring Boot Tutorial is designed with the basic and advanced concept of Spring Boot Framework for beginners and professionals both. It covers all topics of Spring Boot, such as features, Maven project, Spring Initializr, CLI, annotations, properties, starters, actuator, JPA, JDBC, etc.

Before learning the Spring Boot, you must have the basic knowledge of Spring Framework and Java.

Requirements

  • Java compatibility: Spring boot is compatible with Java 1.6 or above versions.
  • Maven: Spring Boot is compatible with Apache Maven 3.2 or above versions.
  • Container: Any servlet 3.0+ compatible container. For example, Tomcat 7 or above versions.
  • Spring Framework: Spring Framework 4.3.10 release or above.

*If you are using Tomcat 8, then the servlet version should be 3.1 and Java 7 or above.

Spring Boot Microservice Architecture

Microservice allows us to break the large systems into the number of independent collaborating processes. Let’s see microservice architecture.

The microservice architecture allows avoiding monolith application for the large system. It provides loose coupling between collaborating processes that running independently in different environments with tight cohesion.

For example, imagine an online shopping with separate microservice for user-account, product-catalog order processing, and shopping carts. These components are inevitably important for such a large online shopping portal.

Shopping Portal Example with microservices:

In this architecture style, the main application divided into a set of sub-application called microservices. One large application divided into multiple collaborating processes as below.

spring Boot Microservice Architecture

Shopping Portal without Microservices:

In this architecture, we are using monolith architecture that combines all components in one application.

Shopping Portal without Microservices

Challenges of Microservices Architecture

Microservice architecture is more complex than the legacy system. The microservice environment becomes more complicated because the team has to manage and support many moving parts. Here are some of the top challenges that an organization face in their microservices journey:

  • Bounded Context
  • Dynamic Scale up and Scale Down
  • Monitoring
  • Fault Tolerance
  • Cyclic dependencies
  • DevOps Culture

Bounded context: The bounded context concept originated in Domain-Driven Design (DDD) circles. It promotes the Object model first approach to service, defining a data model that service is responsible for and is bound to. A bounded context clarifies, encapsulates, and defines the specific responsibility to the model. It ensures that the domain will not be distracted from the outside. Each model must have a context implicitly defined within a sub-domain, and every context defines boundaries.

In other words, the service owns its data and is responsible for its integrity and mutability. It supports the most important feature of microservices, which is independence and decoupling.

Dynamic scale up and scale down: The loads on the different microservices may be at a different instance of the type. As well as auto-scaling up your microservice should auto-scale down. It reduces the cost of the microservices. We can distribute the load dynamically.

Monitoring: The traditional way of monitoring will not align well with microservices because we have multiple services making up the same functionality previously supported by a single application. When an error arises in the application, finding the root cause can be challenging.

Fault Tolerance: Fault tolerance is the individual service that does not bring down the overall system. The application can operate at a certain degree of satisfaction when the failure occurs. Without fault tolerance, a single failure in the system may cause a total breakdown. The circuit breaker can achieve fault tolerance. The circuit breaker is a pattern that wraps the request to external service and detects when they are faulty. Microservices need to tolerate both internal and external failure.

Cyclic Dependency: Dependency management across different services and its functionality is very important. The cyclic dependency can create the problem, if not identified and resolved promptly.

DevOps Culture: Microservices fits perfectly into the DevOps. It provides faster delivery service, visibility across data, and cost-effective data. It can extend its use of containerization switch from Service-Oriented-Architecture (SOA) to Microservice Architecture (MSA).

Other challenges of microservices

  • As we add more microservices, we have to be sure they can scale together. More granularity means more moving parts which increase complexity.
  • The traditional logging is ineffective because microservices are stateless, distributed, and independent. The logging must be able to correlate events across several platforms.
  • When more services interact with each other, the possibility of failure also increases.

Advantages and Disadvantage of Spring Boot

Advantages

  • Easy to understand and develop spring applications.
  • Spring Boot resolves the dependency conflict because it identifies the required dependencies itself.
  • It increases productivity and reduces development time.
  • It provides an embedded HTTP server so that we can develop and test applications quickly.
  • It has excellent integration with IDEs like eclipse and IntelliJ idea and Netbeans.
  • It reduces the run-time classloader issues because it contains information of all dependencies.
  • Simplified security.
  • We can build anything REST API, Web Socket, Microservices, and more.
  • It provides production-ready features such as tracing, metrics, and health status.

Disadvantages

  • Spring boot may unnecessarily increase the binary deployment size because of unused dependencies.
  • It is not able to customize logging easily.
  • In some cases, its exception handling is poor.
  • It is not encouraged if you are developing large and monolithic applications.
Share this post