Spring boot Flashcards

1
Q

What is spring boot ?

A
  • It is used to build stand-alone and production ready spring applications. Spring Boot provides a good platform for Java developers to develop a stand-alone and production-grade spring application.
    • Easy to understand and develop spring applications
    • Reduces the development time
    • Spring Boot is designed to avoid complex XML configuration in Spring ,to develop a production ready Spring applications in an easier way,to reduce the development time and run the application independently ,offer an easier way of getting started with the application
    • The use of POJO(Plain Old Java Objects ) or spring beans
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain dependency Injection ?

A
  • It is a software design pattern where dependent objects are injected into my class .
    • A class uses functionalities of another class .
    • The use of a controller and inject a service for interacting with the database .
    • The controller does not need to know anything about the database, and the service does not need to know about the web part.
    • It makes testing much easier with the injection of a mock database service in a test configuration .
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Ecplain Iversion of control ?

A
  • Dependencies are being injected into my class, IoC is the actual injection of the dependencies .
  • Through IoC the spring framework manages the software compnents and injection of components into dependent objects .
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is spring context ?

A

-It looks at the class files of the source code (the spring beans ), then looks at the configuration of the context and wires up the environment .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to create Spring Boot application using Maven?

A

There are multiple approaches to create Spring Boot project. We can use any of the following approach to create application.
• Spring Maven Project , Spring Starter Project Wizard ,Spring Initializr, Spring Boot CLI

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Spring Boot Advantages ?

A
  • Providesauto-configuration
  • Creates stand-alone applications
  • It provides opinionated ‘starter’ POMs to simplify your Maven configuration.
  • It comes with embedded tomcat, servlet containers jetty to avoid the usage of WAR files
  • Provides CLI tool to develop and test applications
  • Comes with Spring Boot starters to ensure dependency management and also provides various security metrics
  • Integrates with Spring Ecosystem like SpringJDBC, Spring ORM, Spring Data, Spring Security easily .
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Spring boot features ?

A
  • Spring CLI
  • Starter Dependency
  • Spring Initializer : This is basically a web application, which can create an internal project structure for you. So, you do not have to manually set up the structure of the project.
  • Auto-Configuration –:The auto-configuration feature of Spring Boot helps in loading the default configurations according to the project you are working on.
  • Spring Actuator : Accsess to logs and data flows , mapping in the controller, the CPU usage, etc.
  • Logging and Security
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What happens in the background when a Spring Boot Application is “Run as Java Application”?

A

When a Spring Boot application is executed as “Run as Java application”, then it automatically launches up the tomcat server as soon as it sees, that you aresta developing a web application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Spring boot starters

A

They aredependency management providers which can be used in the application to enable dependencies.
These starters, make development easy and rapid.
• spring-boot-starter: –It includes logging, auto-configuration support, and YAML( can be used instead of the propreties file and used for configuration files ).
• spring-boot-starter-jdbc –This starter is used for HikariCP connection pool with JDBC
• spring-boot-starter-web –Is the starter for building web applications
• spring-boot-starter-data-jpa –Is the starter to use Spring Data JPA with Hibernate
• spring-boot-starter-security –Is the starter used for Spring Security
• spring-boot-starter-test:Is the starter for testing Spring Boot applications
==> Connection pools : Connection pools are essentially a cache of open database connections. Once you open and use a database connection instead of closing it you add it back to the pool. When you go to fetch a new connection, if there is one available in the pool, it will use that connection instead of establishing another.
==> HikariCPis a very fast lightweight Java connection pool.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is hibernate ?

A

Hibernate is a Java framework that simplifies the development of Java application to interact with the database.
It is an open source ORM (Object Relational Mapping) tool. Hibernate implements the specifications of JPA for data persistence.
+: open source,fast performance ,database independent query, automatic table creation …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is servlet container support ?

A

Hibernate is a Java framework that simplifies the development of Java application to interact with the database.
It is an open source ORM (Object Relational Mapping) tool. Hibernate implements the specifications of JPA for data persistence.
+: open source,fast performance ,database independent query, automatic table creation …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is thymleaf ?

A

Thymeleaf is a server-side Java template engine used for web applications,
To use Thymeleaf, we need to add the dependency in the pom.xml file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Spring Initilizr ?

A

It is a web tool provided by Spring. With the help of this tool, you can create Spring Boot projects by just providing project details

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

@RestController annotation :

A

It is used to create RESTful web services using Spring MVC. SpringRestControllertakes care of mapping request data to the defined request handler method.
@Controller+ @ResponseBody
Controllers are identified with the RestController annotation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

@RequestMapping annotation :

A

It is used to provide the routing information and tells to Spring that any HTTP request must be mapped to the respective method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is JPA ?

A

It is aJava specification for managingrelationaldata in Java applications. It allows us to access and persist data between Java object/ class and relational database. JPA followsObject-Relation Mapping(ORM).