Professional Documents
Culture Documents
Spring Questions
Spring Questions
LifeCycle of IOC
Rules of DI
1. Constructor-based Dependency Injection:- in this dependent object is provided
as the parameter in the constructor of class .
it is provided when class is instantiated.
Autowiring can't be used to inject primitive and string values. It works with
reference only.
1. XML Based Configuration: This is the most common and popular way of
configuring the Spring beans. The beans are configured using the
XML file, which contains all the bean definitions.
2. Prototype: The prototype scope creates a new instance of the bean every time a
request is made.
3. Request: The request scope creates a new instance of the bean for each HTTP
request.
4. Session: The session scope creates a new instance of the bean for each HTTP
session.
5. Global Session: The global session scope is similar to the session scope, except
it is shared across different servlet contexts.
@Value :- it is used to inject literal values into fields ,methods & constructor
it is used to inject literal values in properties
Persistent Methods:
Implemented methods:
• Data Access Object (DAO) - provides an interface for accessing data from the
database.
• Query Interface - provides a way to create, execute, and manage queries.
• Transaction Management - provides an abstraction layer for managing transactions.
• Object-Relational Mapping (ORM) - provides a way to map Java objects to database
tables.
• Object/Relational (O/R) Metadata Mapping - provides a way to define relationships
between Java objects and database tables.
• Data Access Template - provides a way to easily access and manipulate data in the
database.
SPRING ORM:-
1. it is used to map objects into database tables.
2. it provides easy access to databased methods.
3. these methods are created by using object relational mapping configuration
are used to perform required operations
4. **Additionally , persistent methods can save , retrieve data from database
2. DispatcherServlet, receives the request and checks the web.xml file to identify the
appropriate Controller.
3. The DispatcherServlet maps the request to the appropriate Controller and calls its handler
methods.
4. The Controller processes the request and generates the Model or view object.
6. The View Resolver identifies the appropriate View Component and prepares the output.
7. The DispatcherServlet passes the output to the web browser.
APPLICATION CONTEXT
1. it is heavy weight container
2. provides more advanced configuration as AOP, iL8n,& validations
3. it creates bean when it is loaded
4. it has the ability to publish events to the beans that are registered as
listeners .