Container, Dependency and IoC Flashcards

1
Q

What is Dependency Injection

A

A process whereby a framework establishes relationships between different parts of an application.

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

What are advantages of dependency injection

A
  • Reduced coupling, cohesion, boilerplate code

- Increases testability, reusability, maintainability

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

What is an interface

A

Is a reference type, can contain constants, method signatures, default/static methods

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

Advantages of an interface

A
  • Allows for decoupling, modularization, handling of groups of objects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why are Interfaxes recommended by Spring

A
  • Increased Testability
  • Allows for Jdk Proxying
  • Easier switching of Spring bean implementation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Stereotype Annotations

A
@Component
@Controller
@RestController
@Repository
@Service
@Configuration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Bean scopes

A
singleton
 - Single Bean instance 
prototype
 - Each Time an instance is created
request 
session
application 
websocket
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Limitations of JDK Dynamic Proxies

A
  • requires proxied object to implement at least one interface
  • only methods found the interface are available in the proxy
  • does not support self invocations
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Limitations of CGLIB Proxies

A
  • Proxied object non final
  • Methods in proxied object non final
  • Does not support self invocations
  • Third-party library
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Advantage Proxy object

A
  • Can add power to existing beans

- Separation to business logic

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

Disadvantages Proxy Object

A
  • Not obvious where a method invocation is handled when proxy objects are used
  • Multiple layers of proxy objects -> developers need to take into account the order
  • Overhead
  • Identity issues
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Three Typical Cross Cutting Concerns

A
  • Logging
  • Caching
  • Security
  • Data Validation
  • Transaction management
  • Error handling
  • Monitoring
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which problems does AOP solve

A
  • Code duplication

- Avoding mixing of concerns

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

Join Point

A

A join point is a point in the execution of a program at which additional behavior can be inserted using AOP

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

Pointcut

A

A pointcut selects one or more join points

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

How does Spring solve a cross cutting concern

A

Spring uses proxy objects to implement the method invocation interception part of AOP.

17
Q

How many advice types does Spring support

A
  • Before advice
  • After returning advice
  • After throwing advice
  • After advice
  • Around advice
18
Q

Jdbc Template

A

Is a Spring class that simplifies the use of JDBC by implementing Workflows for querying, updating, ..

19
Q

Benefits of the JDBC Template

A
  • Simplification
  • Handles Exceptions
  • Translates Exceptions
  • Avoid common mistakes
20
Q

Callback

A

A callback is code or reference to a piece of code that is passed as an argument to a method that, at some point during the execution of the methods, will call the code passed as an argument.

21
Q

Transaction

A

A transaction is an operation that consists of a number of tasks that takes place as a single unit - either all tasks are performed or no tasks are performed.

22
Q

ACID principle

A
  • Atomicity
    • The changes within a
      transaction are either all
      applied or none applied
  • Consistency
    • Any integrity constraints are not violated
  • Isolation
    • Translations don’t effect each other
  • Durability
    • Changes applied as the result of a
      successfully completed transaction are
      durable
23
Q

Transaction isolation level

A

Determine how the changes within a transaction are visible to other users and systems accessing the database prior to the transaction being commited.