Term
Define HibernateTemplate. |
|
Definition
A helper class which provides different methods for querying/retrieving data from the database. |
|
|
Term
|
Definition
An external agent (Container) pre-instantiates the object and delivers it ready for use when the calling code requires it. |
|
|
Term
What are the features of Spring?
(Hint: 7) |
|
Definition
Lightweight, Inversion of Control (IoC), Aspect Oriented (AOP), Container, MVC Framework, Transaction Management, JDBC Exception Handling. |
|
|
Term
What are the ways to access Hibernate using Spring?
(Hint: 3) |
|
Definition
- DI with the HibernateTemplate and Callback.
- Extending HibernateDaoSupport and applying an AOP interceptor.
- Hibernate Contextual Sessions.
|
|
|
Term
What is the browser/server interaction for Spring MVC?
(Hint: 5) |
|
Definition
1. Browser sends URL to server. 2. Server sends request/response pairs to Web Container. 3. Web Container reads web.xml and finds correct servlet. 4. Web Container takes a new thread from the pool and passes HTTP Request and Response objects to it. 5. Thread calls service() (MVC- framework takes over) on the Servlet (Front Controller).
|
|
|
Term
What are the benefits of the Spring framework transaction management?
(Hint: 4) |
|
Definition
- Provides a consistent programming model across different transaction API.
- Supports declarative transaction management.
- Provides a simpler API for programmatic transaction management.
- Integrates very well with Spring's various data access abstractions. |
|
|
Term
What is Spring's JDBC template? |
|
Definition
A central class to interact with a database through JDBC. |
|
|
Term
Explain the Spring module Context. |
|
Definition
A configuration file that provides context information to the Spring framework. |
|
|
Term
|
Definition
A design principle that refers to the decoupling of the specification of a behavior from when it is actually executed. |
|
|
Term
|
Definition
A technique that modularizes Cross Cutting Concerns across multiple classes. |
|
|
Term
What are the advantages of Spring framework?
(Hint: 4) |
|
Definition
- It has layered architecture (use what you need).
- It enables POJO programming.
- DI and IoC simplifies JDBC.
- Open source and no vendor lock-in. |
|
|
Term
What are the benefits of IoC?
(Hint: 4) |
|
Definition
- Minimizes the amount of code.
- Makes your application more testable.
- Loosely coupled.
- Support eager instantiation and lazy loading. |
|
|
Term
What benefits does the HibernateTemplate have?
(Hint: 4) |
|
Definition
- Simplifies interactions with Hibernate Session.
- Common functions are simplified to single method calls.
- Sessions are automatically closed.
- Exceptions are automatically caught and converted to runtime exceptions. |
|
|
Term
How do you integrate Struts with Spring?
(Hint: 5) |
|
Definition
1. In struts-config, install ContextLoaderPlugin.
2. In action tag, type="org.springframework.web.struts.DelegatingActionProxy" 3. In action-servlet.xml, map html action to action class + reference the injection. 4. In appContext.xml, map injected bean to the bean class. 5. In action class, install setter for injected bean. |
|
|
Term
Explain the Spring module Web. |
|
Definition
Builds on top of the ApplicationContext module, providing contexts for Web-based applications. |
|
|
Term
Name 4 benefits of Spring. |
|
Definition
1. Layered/distributed architecture (non-intrusive) .
2. Loosely coupled.
3. Simplifies creation of business methods.
4. Lightweight. |
|
|
Term
How did you integrate Spring and Hibernate using Template Injection?
(Hint: 4) |
|
Definition
1. Wire up the following: basic data source, local session factory, hibernate template, Dao impl. 2. Place setter for Template in Dao Impl. 3. Create anonymous inner class to implement doInHibernate method of CallBack interface and place desired CRUD there. 4. Pass inner class obj to Template, execute method to invoke desired CRUD operations. |
|
|
Term
What is Xml Web Application Context? |
|
Definition
It loads context definitions from an XML file contained within an web application. |
|
|
Term
Explain how to integrate Spring and Hibernate using Contextual Sessions via the Proxy bean approach.
(Hint: 3) |
|
Definition
- Create the DaoImpl class with a setter for the Session Factory.
- Wire up the following: data source, SessionFactory, HiberanteTransactionManager, TransactionProxyFactoryBean, and the target.
- Bind each CRUD method to a transaction in the TransactionProxyFactoryBean. |
|
|
Term
What is File System Xml Application Context? |
|
Definition
It loads context definitions from an XML file in the file system. |
|
|
Term
List some ways that ApplicationContext is better than BeanFactory.
(Hint: 5) |
|
Definition
- Provides a means to resolve text messages (i18n).
- Provides a way to load file resources.
- Certain operations can be handled derivatively.
- ApplicationContext is a Resource Loader.
- Implements Message Source; for localized services. |
|
|
Term
What does the View Resolver do? |
|
Definition
It provides a response suitable to the browser. |
|
|
Term
What does the Handler Mapping do? |
|
Definition
It tells Dispatcher Servlet what class to service the url with. |
|
|
Term
|
Definition
It is an open source framework created to address the complexity of enterprise application development. |
|
|
Term
What is Dependency Injection? |
|
Definition
A process where objects define their dependencies through a constructor argument or properties that are set on the object instance after it has been constructed. |
|
|
Term
What is the Dispatcher Servlet? |
|
Definition
It takes incoming URL and finds the right combination of handlers and views (JSP) that combine to form the page or resource that is suppose to be found at the location. |
|
|
Term
What do you mean by Auto wiring? |
|
Definition
Spring has the ability to automatically wire relationships between collaborating beans. |
|
|
Term
What is Application Context? |
|
Definition
An interface that represents the Spring IoC container and is responsible for instantiating, configuration, and assembling the beans. |
|
|
Term
What is the typical Bean life cycle in Spring Bean Factory Container?
(Hint: 7) |
|
Definition
- Container finds bean def. and instantiates it. - Using DI, Spring populates all properties of bean def. - If bean impl BeanNameAware intrfce, factory calls setBeanName(), passing bean id. - If bean impl BeanFactoryAware intrfce, factory calls setBeanFactory(), passing instance of self. - If bean associates w/ BeanPostProcessers, postProcessBeforeInitialization() is called. - If init-method is specified, it is called. - If bean associates w/ BeanPostProcessors , postProcessAfterInitialization() is called. |
|
|
Term
Explain the Spring module DAO. |
|
Definition
It offers a meaningful exception hierarchy for managing the exception handling and error messages thrown by different database vendors. |
|
|
Term
What is Class Path Xml Application Context? |
|
Definition
It loads context definitions from an XML file, treating context definitions as classpath resources. |
|
|
Term
|
Definition
An object that is instantiated, assembled, and managed in a Spring Core Container. |
|
|
Term
What does the Bean Factory provide? |
|
Definition
It provides the configuration framework and basic functionality. |
|
|
Term
What does the Application Context provide? |
|
Definition
It adds more enterprise-specific functionality onto the Bean factory. |
|
|
Term
What are the common implementations of the Application Context?
(Hint: 3) |
|
Definition
- Class Path XML Application Context.
- File System XML Application Context.
- XML Web Application Context. |
|
|
Term
|
Definition
A means to access objects in a framework-style manner that is similiar to a JNDI registry. |
|
|