Midterm Flashcards
what does spring do
makes programming quicker, easier and safer.
Focuses on speed, simplicity and productivity
(Spring Boot) is a tool that makes developing web application and microservices with Spring Framework faster and easier through three core capabilities
autoconfiguration
an opinionated approach to configuration
the ability to create standalone applications
A ___ ___ is a single-tiered software application in which different modules are combined into a
single program
monolithic application
___ ___ is considered to be a traditional way of building applications. A monolithic application
is built as a single and indivisible unit. Usually, such a solution comprises a client-side user interface, a server
side-application, and a database. It is unified and all the functions are managed and served in one place
Monolithic architecture
monolithic applications
strengths
less ___-___ concerns - are concerns that affect the whole application such as logging, handling, caching and performing monitoring. In a monolithic application, this area of functionality concerns only one application so it is easier to handle it.
Easier ___ and ___ - because it is a single indivisible unit
simple to ___
simple to ___
less cross cutting concerns
easier debugging and testing
simple to deploy
simple to develop
monolithic applications weaknesses
______ - scaling up makes it complex
harder to __ __
____
new ___ ___ - whole application must be rewritten
understanding
make changes, changes can affect the whole system
scalability - cannot scale components separately, must be the whole applications
new technology barriers
A ___ ____breaks it down into a collection of smaller independent units. These units carry
out every application process as a separate service. So all the services have their own logic and the database as well as perform the specific functions.
independent modules communicate with each other through ___
microservices architecture
API
____ refers to the process of associating a URL (endpoint) with a specific handler method in a controller.
Mapping
___ __ is a fundamental concept in Spring Boot that plays a crucial role in achieving Inversion of Control (IoC).
Allows you to provide the dependencies that a class or component needs, rather than having the class create its dependencies.
This approach promotes ___ ___ and makes your code more modular and easier to maintain.
Dependency Injection (DI)
loose coupling
_____ - is an object or component that another piece of code relies on to
perform its tasks.
dependency
___ ___ ___ - In traditional programming, your code controls
the flow of execution, including the creation and management of dependencies. In contrast, with __, control is inverted; a framework or container (like Spring Boot) manages the creation and injection of dependencies. Your code
focuses on its core logic, while the container handles the wiring of components.
inversion of control (IOC)
____ ____ ____ - is responsible for managing the creation and wiring of objects (beans) in your application. It scans your codebase for classes annotated with annotations like @Component, @Service, @Repository, and others, and it creates instances of these classes as beans. It also manages the lifecycle of these
beans, handling tasks like initialization and destruction
spring IoC container
types of dependency injection
Constructor Injection: The most recommended and common form of DI in Spring Boot. Dependencies are
declared as constructor parameters, and the container automatically provides instances when creating objects
Setter Injection: Dependencies are provided via setter methods in the class
Field Injection: Dependencies are injected directly into class fields using annotations like @Autowired.
benefits of dependency injection
___ - Components are loosely coupled, allowing them to be developed, tested, and maintained independently
__
modularity
reusability
testing
____in Spring Boot means that the control over creating and managing objects (beans) and their dependencies is transferred from your application to the ____ ___ ___.
IoC
Spring IoC container
make a version of this code with dependency injection
class Car{
private Engine engine = new Engine();
public void start(){
engine.start();
}
}
class myApp{
public static void main(String[] args){
Car car = new Car();
car.start();
}
}
instead of having car reference the engine, inject engine into car
class Car{
private final Engine engine;
public Car(Engine engine){
this.engine=engine;
}
public void start(){
engine.start();
}
}
class myApp{
public static void main(string[] args)
{
Engine engine = new Engine();
Car car = new Car(engine);
car.start();
}
}
what does @Component do
tells spring boot that the class is a bean
what does @Autowired do
indicate where dependencies should be injected
signal the container to provide the required dependency
what is lombok good for
reduces the need for writing repetitive code
lombok operates at ___ ___
compile time
when the source code is compiled, not when the application is ran
____ code is code that you have to write over and over again for common tasks
Boilerplate
why lombok is important
reduces ___ code
enhances ___
saves ___
minimizes __
boilerplate
readability
time
errors
lombok
@Data
combines __________________
@Getter
@Setter
@ToString
@EqualsAndHashCode
@RequiredArgsConstructor
lombok logging annotations
@slf4j
@Log
Default Message