Spring boot - overview

 

Describe the flow of HTTPS requests through the Spring Boot application?

On a high-level spring boot application follow the MVC pattern which is depicted in the below flow diagram.

Spring Boot Flow Architecture

24. What is the difference between RequestMapping and GetMapping?

RequestMapping can be used with GET, POST, PUT, and many other request methods using the method attribute on the annotation. Whereas getMapping is only an extension of RequestMapping which helps you to improve on clarity on request.

25. What is the use of Profiles in spring boot?

While developing the application we deal with multiple environments such as dev, QA, Prod, and each environment requires a different configuration. For eg., we might be using an embedded H2 database for dev but for prod, we might have proprietary Oracle or DB2. Even if DBMS is the same across the environment, the URLs will be different.

To make this easy and clean, Spring has the provision of Profiles to keep the separate configuration of environments.

26. What is Spring Actuator? What are its advantages?

An actuator is an additional feature of Spring that helps you to monitor and manage your application when you push it to production. These actuators include auditing, health, CPU usage, HTTP hits, and metric gathering, and many more that are automatically applied to your application.

27. How to enable Actuator in Spring boot application?

To enable the spring actuator feature, we need to add the dependency of “spring-boot-starter-actuator” in pom.xml.

<dependency>
<groupId> org.springframework.boot</groupId>
<artifactId> spring-boot-starter-actuator </artifactId>
</dependency>
What is Spring?

Before understanding Spring let’s understand what is a Framework? The framework is a re-usable design platform for software systems, which provides support for code libraries and various scripting languages In simple words a framework is something that makes core programming easy. There are frameworks for PHP, Perl, Java, Python, Ruby, and many other languages. All Software Frameworks are built with the idea of reusability of the code and provide tools that help programmers develop and bind together different components of a software project.

Now, we know what a framework is so let’s jump to the definition of Spring. What is Spring? Spring is a lightweight application framework and we can say it is similar to the framework of frameworks because it provides support to various frameworks such as Struts, JSP, Hibernate, etc. The first version of the Spring framework was written by Rod Johnson in 2002 and the framework was first released in 2003 under the Apache license version 2.0.


BasisSpringSpring Boot
Where it’s used?Spring framework is a java EE framework that is used to build applications.Spring Boot framework is mainly used to develop REST API’s
Key featureThe primary or most important feature of the Spring framework is dependency injection(Dependency Injection (DI) is a design technique that removes dependencies from computer code, making the application easier to maintain and test).The main or primary feature of the Spring Boot is Autoconfiguration( Simply described, Spring Boot autoconfiguration is a method of automatically configuring a Spring application based on the dependencies found on the classpath.)
Autoconfiguration can speed up and simplify development by removing the need to define some beans that are part of the auto-configuration classes.
Why it’s usedIts goal is to make Java EE (Enterprise Edition) development easier, allowing developers to be more productive.Spring Boot provides the RAD(Rapid Application Development) feature to the Spring framework for faster application development.
Type of Application DevelopmentSpring framework helps to create a loosely coupled application.Spring Boot helps to create a stand-alone application.
Servers dependencyIn the Spring framework to test the Spring Project, we need to set up the servers explicitly.Spring Boot offers built-in or embedded servers such as Tomcat and jetty.
Deployment descriptorTo run a Spring application a deployment descriptor is required.In Spring Boot there is no need for the Deployment descriptor.
In-memory database supportSpring framework does not provide support for the in-memory database.Spring Boot provides support for the in-memory database such as H2.
Boilerplate codeSpring framework requires too many lines of code (boilerplate code) even for minimal tasks.You avoid boilerplate code which reduces time and increases productivity.
ConfigurationsIn the Spring framework, you have to build configurations manually.In Spring Boot there are default configurations that allow faster bootstrapping.
DependenciesSpring Framework requires a number of dependencies to create a web app.Spring Boot, on the other hand, can get an application working with just one dependency. There are several more dependencies required during build time that is added to the final archive by default.
HTTP AuthenticationHTTP Basic Authentication is for enabling security confirmations, it indicates that several dependencies and configurations need to be enabled to enable security. Spring requires both the standard spring-security-web and spring-security-config dependencies to set up security in an application. Next, we need to add a class that extends the WebSecurityConfigurerAdapter and makes use of the @EnableWebSecurity annotation.Spring Boot also requires these dependencies to make it work, but we only need to define the dependency of spring-boot-starter-security as this will automatically add all the relevant dependencies to the classpath.
TestingTesting in Spring Boot is difficult in comparison to Spring Boot due to a large amount of source code.Testing in Spring Boot is easier due to the reduced amount of source code.
XML ConfigurationIn the Spring framework, XML Configuration is required.No need for XML configuration in Spring Boot.
CLI ToolsSpring framework does not provide any CLI tool for developing and testing applications.Spring Boot provides a CLI tool for developing and testing Spring Boot applications.
PluginsSpring framework does not provide any plugin for maven, Gradle, etc. like Spring Boot.Spring Boot provides build tool plugins for Maven and Gradle. The Plugins offer a variety of features, including the packaging of executable jars.

Comments

Popular posts from this blog

Spark Cluster

DORA Metrics