What Is A Framework
What Is A Framework
A framework is like the foundation upon which developers build applications for
specific platforms. It includes reusable pieces of code written to perform common
tasks and uses code provided by a developer for custom functionality. The
framework may include defined and undefined objects and functions that
developers can use to create applications
What is a Library?
A library is a collection of prewritten code that can be used to simplify tasks. The
term library simply refers to a collection of code that is reused repeatedly. It is
essentially a set of pre-defined functions and classes that programmers can use
to simplify their work and speed up the development process. So, developers do
not have to write code to accomplish specific functionality
, Hibernate
, Tapestry, EJB
, JSF
The Spring framework comprises several modules such as IOC, AOP, DAO, Context, ORM, WEB
MVC etc
Spring Framework
The Spring Framework (Spring) is an open-source application framework that
provides infrastructure support for developing Java applications. One of the
most popular Java Enterprise Edition (Java EE) frameworks, Spring helps
developers create high performing applications using plain old
Java objects (POJOs).
Released in June 2003 by Rod Johnson under the Apache 2.0 license, the
Spring Framework is hosted by SourceForge.
Why Spring?
Java programs are complex and feature many heavyweight components.
Heavyweight means the components are dependent on the underlying
operating system (OS) for their appearance and properties.
Spring is considered to be a secure, low-cost and flexible framework. Spring
improves coding efficiency and reduces overall application development time
because it is lightweight -- efficient at utilizing system resources -- and has a
lot of support.
1. Presentation/view layer (UI) - This is the outermost layer which handles the
presentation of content and interaction with the user.
2. Business logic layer - The central layer that deals with the logic of a
program.
3. Data access layer - The deep layer that deals with data retrieval from
sources.
@component - Lets Spring know which classes to manage (create). Marks the
beans (objects) as managed components, which means that Spring will
autodetect these classes for dependency injection.
Important terms
Autowiring - The process by which Spring identifies dependencies and
matches and populates them.
If we were to apply the inversion of control pattern to the above example, the
developer could not use the new keyword and call the constructor of the Question
class.
Instead, when needed, a magical and mysterious black box -- often referred to as the
IoC container -- will provide instances of the Question class.
Question q1 =
MysteriousBlackBox.getInstance(Question.class);
The use of the MysteriousBlackBox class in the previous line of code may seem silly,
but it's actually not.