Midterm Flashcards

1
Q

what does spring do

A

makes programming quicker, easier and safer.

Focuses on speed, simplicity and productivity

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

(Spring Boot) is a tool that makes developing web application and microservices with Spring Framework faster and easier through three core capabilities

A

autoconfiguration

an opinionated approach to configuration

the ability to create standalone applications

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

A ___ ___ is a single-tiered software application in which different modules are combined into a
single program

A

monolithic application

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

___ ___ 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

A

Monolithic architecture

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

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 ___

A

less cross cutting concerns

easier debugging and testing

simple to deploy

simple to develop

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

monolithic applications weaknesses
______ - scaling up makes it complex

harder to __ __

____

new ___ ___ - whole application must be rewritten

A

understanding

make changes, changes can affect the whole system

scalability - cannot scale components separately, must be the whole applications

new technology barriers

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

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 ___

A

microservices architecture

API

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

____ refers to the process of associating a URL (endpoint) with a specific handler method in a controller.

A

Mapping

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

___ __ 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.

A

Dependency Injection (DI)
loose coupling

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

_____ - is an object or component that another piece of code relies on to
perform its tasks.

A

dependency

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

___ ___ ___ - 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.

A

inversion of control (IOC)

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

____ ____ ____ - 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

A

spring IoC container

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

types of dependency injection

A

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.

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

benefits of dependency injection
___ - Components are loosely coupled, allowing them to be developed, tested, and maintained independently

__

A

modularity
reusability
testing

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

____in Spring Boot means that the control over creating and managing objects (beans) and their dependencies is transferred from your application to the ____ ___ ___.

A

IoC
Spring IoC container

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

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();
}
}

A

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();
}
}

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

what does @Component do

A

tells spring boot that the class is a bean

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

what does @Autowired do

A

indicate where dependencies should be injected

signal the container to provide the required dependency

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

what is lombok good for

A

reduces the need for writing repetitive code

20
Q

lombok operates at ___ ___

A

compile time
when the source code is compiled, not when the application is ran

21
Q

____ code is code that you have to write over and over again for common tasks

A

Boilerplate

22
Q

why lombok is important

reduces ___ code

enhances ___

saves ___

minimizes __

A

boilerplate

readability

time

errors

23
Q

lombok
@Data
combines __________________

A

@Getter
@Setter
@ToString
@EqualsAndHashCode
@RequiredArgsConstructor

24
Q

lombok logging annotations

A

@slf4j
@Log

25
Q

lombok
@Builder annotation syntax

A

Person person = Person.builder()
.name(“Alice”)
.age(30)
.address(“123 main street”)
.build();

use @Builder in bean class

26
Q

Thymeleaf is a powerful and versatile ____ ____ for web development.

it allows developers to create dynamic web pages by embedding dynamic content within HTML, XML, and other document types

A

templating engine

27
Q

Thymeleaf’s primary goal is to simplify the process of generating ___ ____ ____, making it an essential tool for modern web application development.

A

dynamic web content

28
Q

thymeleaf is designed to work in both ___ and ___ environments

A

web and standalone

29
Q

thymeleaf has the capability to __________________

A

process a wide range of document type

30
Q

thymeleaf

___ ____ - allows injecting logic into template files without disrupting their use as design prototypes. This approach enhances communication between design and development teams

bridging ____ and ___

___ ___ ____

A

natural templates

design and development

web standard compliance

31
Q

thymeleaf use cases
(2)

A

web applications

design prototyping - dont have to worry about logic

32
Q

templates that thymeleaf can process
(6)

A

HTML
CSS
JAVASCRIPT
RAW
XML
TEXT

33
Q

The ____ attribute is used to set the text content of an HTML element in a Thymeleaf template. It allows you to
dynamically replace the text within an element with data from your application’s model or other expressions.

syntax

A

th:text

<p>Default Message</p>

34
Q

The ___ attribute is used for iterating over collections

syntax

A

th:each

<ul>
<li></li>
</ul>

loops whatever tag it is attached to

35
Q

th:if and th:unless syntax

A

<span th:if=”${employee.gender} == “M”” th:text=”male”/>

<span th:unless=”${employee..gender} == “M”” th:text=”female”/>

36
Q

switch and case syntax

A

<td>
<span></span>
<span></span>
</td>

37
Q

how to use images

A

<img></img>

38
Q

___ __ ___ rely on system memory as opposed to disk space for
storage of data. Because memory access is faster than disk access, these databases are naturally faster

A

In-memory databases

39
Q

___ _______is a high-performance, lightweight, and embeddable relational database management system (RDBMS)
written in Java

A

H2 Database

40
Q

H2 database features

A

in memory and file-based modes

embedded database

ACID compliance (atomicity, consistency, isolation, durability)

Small footprint

compatibility

built in functions

web based console

41
Q

H2 use cases

A

development and testing

embedding databases

prototyping and proof of concept

educational purposes

42
Q

JDBC (Java Database Connectivity) is a Java-based API that allows Java applications to interact with ____ ____

simplifies ___

A

relational databases

database access

43
Q

JDBC key features

A

siplifies JDBC code

exception handling

connection management

named parameters

batch processing

result mapping

44
Q

CRUD meaning

A

create read update delete

45
Q

path variables
let you __________

syntax

A

capture values directly from a url

@GetMapping(“/book/{bookID}”)
public Book getBookDetails(@PathVariable Long bookID){

}

46
Q

update query

A

String query = “UPDATE tableName SET name1 = :name1, name2 = :name2 WHERE id = :id”

do a namedParameters.addValue for each variable

jdbc.update(query, namedParameters)