What is BeanNameUrlHandlerMapping in Spring MVC
I have taken these nots from few of the eBooks.
I have taken these nots from few of the eBooks.
=================================
What are the advantages of spring framework?
What is the purpose of each module in spring framework?
=================================
- Spring provides a light-weight solution for building enterprise-ready applications, declarative transaction management
- remote access to your logic using RMI or web services
- various options for persisting your data to a database
- Spring provides a full-featured
- Spring is modular, allowing you to use just those parts of it that you need, without having to bring in the rest.
- Spring could potentially be a one-stop-shop for all your enterprise applications
- Transparent ways of integrating
- AOP into your software.
- BeanFactory, which provides a sophisticated implementation of the factory pattern which removes the need for programmatic singletons and allows you to decouple the configuration and specification of dependencies from your actual program logic.
8) Spring has been (and continues to be) designed to be non-intrusive, meaning dependencies on the framework itself are generally none (or absolutely minimal, depending on the area of use).
- Context package à and adds support for internationalization (I18N) (using for exampleresource bundles), event-propagation, resource-loading, and the transparent creation of contexts
11) The DAO package à removes the need to do tedious JDBC coding provides a way to do programmatic as well as declarative transaction management
- 12) The ORM package ' provides integration layers for popular object-relational mapping APIs, including JPA, JDO, Hibernate, and iBatis.
- 13) Spring's Web package ' provides basic web-oriented integration features, such as multipart file-upload Functionality
- 14)Spring's MVC package ' provides a Model-View-Controller (MVC) implementation for web-applications.
- 15) you can use Spring in all sorts of scenarios, from applets up to fully-fledged enterprise applications
- 16) The Spring Framework also provides an access- and abstraction- layer for Enterprise JavaBeans, enabling you to reuse your existing POJOs and wrap them in Stateless Session Beans
- 17) The Spring team have found that the correct use of IoC certainly does make both unit and integration testing easier
- code gets much cleaner when the DI principle is applied
- code gets a higher grade of decoupling is much easier when objects do not look up their dependencies, but are provided with them
- bean do not even know where the dependencies are located and of what concrete class they are.
================================
When to use BeanFactory and when ApplicationContext?
=======================================
is best suited for use in a particular situation. A BeanFactory pretty much just instantiates and configures beans. An ApplicationContext also does that, and it provides the supporting infrastructure to enable lots of enterprise-specific features such as transactions and AOP.
The ApplicationContext interface super set of the BeanFactory (it is a sub-interface)
It has functionality such as
1) easier integration with Spring's AOP
2) message resource handling (for use in internationalization)
3) event propagation
4) application-layer specific contexts such as the WebApplicationContext for use in web applications.
In short, favor the use of an ApplicationContext.
================================
Every bean has one or more ids (also called identifiers, or names; these terms refer to the same thing). These ids must be unique within the container the bean is hosted in. A bean will almost always have only one id, but if a bean has more than one id, the extra ones can essentially be considered aliases.
======================
you are not required to supply a name for a bean. If no name is supplied explicitly, the container will generate a unique name for that bean.
======================
Injecting dependencies
==================
When to use Constructor injection and when Setter-based DI?
Disadvantages of constructor DI
==================
The Spring team generally advocates the usage of setter injection
1) It may be difficult, since a large number of constructor arguments cannot be managed easily.
2) Sometimes arguments may be optional, may not required at all, then you canot use cosntructor DI
3) Sometimes the objects in an argument may be heavy and may consume lots of space.
4) Once configured object is not eligible for reIjection.
Advantage of Constructor DI :
1) Object will never be uninitialized at any moment of time, it will always get injected to calling method.
2)In third pary classes, if you are suing readealy available jar file and you don’t have source code, then you don’t have other choice to use constructor DI as they may not provide you setter method for some particular reason.
The presence of setter methods also makes objects of that class manageable to being re-configured (or re-injected) at some later Time.
In case of JMX MBeans it is a particularly compelling use case
The basic principle behind Dependency Injection (DI) is that objects define their dependencies (that is to say the other objects they work with) through
1) constructor arguments
2) arguments to a factory method
3) properties which are set on the object instance after it has been constructed
it is the job of the container to actually inject those dependencies when it creates the bean. This is fundamentally the inverse, hence the name Inversion of Control (IoC)
================================
What are Advantages of Dependency Injection
================================
No comments:
Post a Comment