Spring Interview Qs Flashcards
What is a POJO?
Plain Old Java Object
Not bound by any special restriction and not requiring any class path.
A POJO is a Java object that is bound to no specific framework, unlike a JavaBean is a special type of POJO with a strict set of conventions.
What is a software framework?
a universal, reusable software environment that provides particular functionality as part of a larger software platform to facilitate development of software applications, products, and solutions
What is a “bean”?
classes that encapsulate many objects into a single object (the bean)…
A bean is an object that is instantiated, assembled, and otherwise managed by a Spring IoC container.
What is REST?
REpresentational State Transfer
A software architectural style that defines a set of constraints to be used for creating web services.
Why use Springboot?
Lightweight and modular; IoC container contains and maintains life cycle and configuration of application objects; helps create MVC; handles JDBC exceptions; loose coupling
Less boilerplate code
Springboot makes it easy to create Java enterprise applications
What does it mean for a system to be “loosely coupled”?
a loosely coupled system is one in which each of its components has, or makes use of, little or no knowledge of the definitions of other separate components. keeps disparate parts independent, flexible, and modular.
What is the Spring IoC Container?
IoC: Inversion of Control. Object gives its dependences instead of creating or looking for dependent objects; provides consistent means of configuring and managing Java objects using reflection. Can also be considered “dependency injection container”
What is Dependency Injection?
A software design concept that allows a service to be used/injected in a way that is completely independent from client consumption. This prevents the client from modifying when the underlying service changes.
It separates the creation of a client’s dependencies from the client’s behavior, which allows program designs to be loosely coupled
Design pattern in Spring that allows loose coupling, helps with single responsibility, deals with the way objects fulfill their dependent objects.
What are the different types of DI?
Constructor-Based: best for required dependencies
Setter-Based: best for optional dependencies (not injected until called)
Field-Based
What is CORS?
Cross-Origin Resource Sharing (CORS) is a header based mechanism that allows a server to indicate any other origins than its own from which a browser should permit the loading of resources.
What does it mean that Spring Boot is “opinionated”?
Spring Boot has intelligent auto-configurations that favor convention and are designed to get you up and running as quickly as possible.
Where do you change the default settings for your Spring project?
application.properties
@Entity
Marks a class to have its fields mapped (as a row) to the columns of a table, in a database.
@GeneratedValue
A value which is generated based on the specified strategy. Defaults to auto.
@ID
Marks the primary key of an Entity.
@Transient
Used to indicate that a field is not to be persisted in the database.* (password)