SPRING OOF Flashcards

1
Q

what is spring?

A

an app framework which focuses on concept of inversion of control containers. essentially a lightweight, integrated framework that can be used for developing enterprise applications in java

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

spring modules

A

context, AOP, DAO, JDBC, ORM, web module, MVC

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

spring context

A

for dependency injection

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

spring AOP

A

for aspect oriented programming

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

spring DAO

A

for database operations using DAO pattern

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

spring JDBC

A

for JDBC and DataSource support

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

spring ORM

A

for ORM tools support such as Hibernate

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

spring Web Module

A

for creating web apps

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

spring MVC

A

Model-View-Controller implementations for creating web applications, web services, etc.

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

what does core container focus on

A

spring beans, core, context, SpEL

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

important annotations in spring configuration

A

@required, @autowired, @qualifier, @resource, @postconstruct, @predestroy

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

bean

A

an object that is instantiated, assembled, and MANAGED BY SPRING IOC CONTAINTER

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

what are 5 scopes of bean

A

singleton, prototype, request, session, global-session

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

bean class

A

has attributes and getter/setter methods

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

singleton

A

only single object by default

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

prototype

A

every time you make a new object it will be new and different

17
Q

request

A

1 object for entire request

18
Q

session

A

1 object for entire request

19
Q

global-session

A

1 object for entire global session

20
Q

how is bean added to spring application?

A

use bean tag in XML where you add id attribute then value

21
Q

dispatcherservlet

A

front controller in spring mvc app as it loads spring bean config file and initializes all the beans that have been configured

22
Q

contextloaderlistener

A

listener to start up and shut down WebApplicationContext in spring root

23
Q

constructor injection

A

inject dependency through constructor. no partial injection. doesn’t override setter property. creates new instance if any modification occurs. better for too many properties

24
Q

setter injection

A

inject dependency through a setter method. partial injection. overrides the constructor property if both are defined. doesn’t create new instance if you change property value. better for few properties

25
autowiring
enables programmer to inject the bean automatically. don't need to write explicit injection logic.
26
what are the autowiring modes?
no, byName, byType, constructor
27
no
default mode, means autowiring is not enabled
28
byName
injects bean based on property name. uses setter method
29
byType
injects bean based on property type. uses setter method
30
constructor
injects bean using constructor
31
how to handle exceptions in spring MVC
using controller based, global exception handler, HandlerExceptionResolver
32
Controller Based
can define exception handler methods in our controller classes
33
Global Exception Handler
Exception Handling is a cross-cutting concern and Spring provides
34
HandlerExceptionResolver
Any Spring bean declared in DispatcherServlet's application context that implements HandlerExceptionResolver will be used to intercept and process any exception raised int he MVC system and not handled by a Controller
35
important spring annotations
@Controller, @PathVariable, @Qualifier, @Configuration, @Scope, @RequestMapping, @ResponseBody, @Autowired, @Service, @Aspect