Spring tutorial-a Baby Step to learn

Source: Internet
Author: User
Tags aop
Turn from: http://www.dineshonjava.com/2012/06/spring-30-baby-step-to-learn.html#. Wl0h-vmgnpy Spring tutorial-a Baby Step to learn Posted by Dinesh Rajput
In the This series of spring tutorial, it's provides many step by step examples and explanations on using spring framework.
The Spring framework, created by Rod Johnson, is a extremely powerful inversion of control (IoC) framework to helps decouple your project components ' dependencies.

On OCT 2002-the first version released in book (Expert one-on-one EE Design and development) by Rod Johnson.

O
n June 2003-take license from Apache and first released as a Framework.
On Jan 2006-Won the awards Jolt Productivity Award and JAX Innovation Award.
On OCT 2006-spring 2.0 released.
On Nov 2007-spring 2.5 released.
On Dec 2009-spring 3.0 released.
On Dec 2011-spring 3.1 released.
On June 2012-spring 3.2 released.
What's SPRING?Spring is great the framework for development of Enterprise grade applications. Spring is a light-weight framework for the development of Enterprise-ready applications. It provides very simple and rich facilities to integrate various frameworks, technologies, and services in the application S. One of the main reason for using the Spring framework are to keep code as simple as possible. IT Push the develop enterprise applications with loosely coupled simple Java beans. For this reason, the spring framework can also is called a Plain old Java Object (POJO) framework.
Spring is the Open-source framework developed by Spring Source, a division of VMware. Spring frame work can summarized in the ways.
container-Spring framework can be described as a light weight container, as it does not involve installation, configuration, start a nd stop activities associated with a container. It's just a simple collection of few Java ARchive (JAR) files, need to being added to the classpath. The Spring Container takes the classes in the application, creates objects, and manages the life cycle of those objects. framework-Spring framework can be described as an application programming Interface (API) containing a large collection of the class Es, methods, interfaces, annotations, XML tags that can is used in an application. The API provides a variety of factory and facade classes that I-use any framework or functionality very easily I n your application.
Data Access Using Java Database Connectivity (JDBC): The Spring Framework provides a rich support for working with JDBC. A typical JDBC code involves plumbing works, such as creating connection, statements, executing queries and handling EXCEP tions for performing database operations. Spring Framework provides a set of classes that take care of these core JDBC operations.

Data Access Using Object relational Mapping (ORM):There is lots of ORM frameworks, such as Hibernate, Toplink, IBatis etc that can is used in Java applications. Spring Framework provides lots of classes, makes working with ORM are very easy.

Aspect Oriented Programming (AOP):One of the main paradigms that spring uses to provide enterprise services for your applications is AOP.  AOP is a mechanism by which you can introduce functionality in your existing code without modifying your design. In short we can say AOP are used to weave cross-cutting functionalities or aspects into the code. The Spring framework uses AOP provides various enterprise services such a transaction and security in an application.

Core Spring Framework:The Core fundamental part of the framework and provides the IoCand Dependency InjectionFeatures. The basic concept here is the beanfactory, which provides a sophisticated implementation of the factory pattern which removes the need for programmatic singletons and allows decouple the configuration and specification of dependencies from your actual program logic.


Spring ' s MVC:Spring MVC Package provides a model-view-controller (MVC) implementation for web-applications. Spring ' s MVC framework is not just any old implementation; It provides a clean separation between domain model code and Web Forms, and allows-you-use all the other features of T The He Spring Framework.

Object XML Mapping:Spring 3.0 introduces the OXM module that is earlier a part of the core framework. OXM is a mechanism this marshals or converts object into the XML format and vice versa. There is lots of OXM frameworks, such as Caster, Xstream, JiBX, Java API for XML Binding (JAXP), and Xmlmeabs. Spring 3.0 provides a uniform API to access any of the these OXM frameworks for marshalling and unmarshalling object and XML.

Dependency Injection (DI):The technology that Spring are most identified and is the Dependency Injection (DI)Flavor of inversion of Control. The inversion of Control (IoC) is a general concept, and it can be expressed in many different ways and Dependency injecti On is merely one concrete example of inversion of Control.
What is dependency injection exactly?Let's look at these, words separately. Here the DependencyPart translates to an association between and classes. For example, class Xis dependent on class Y. Now, let's look at the second part, Injection. All this means was that class YWould get injected into class Xby the IoC. Here we don t need to write lots of code to create the instance of the dependent classes.



Dependency injection promotes loose coupling. It paves the the-the-removal of the Usal factory and utility classes that we write in our applications.
Look following:
The DAOClasses use Data Sourceswhich can injected into them the ServiceClasses need to add few java BeansDependency injection is also known as inversion of Control or IoC. Ioc refers to the control of creating instances being do by the Spring Container. The control for creating and constructing objects are taken care by the container. The container creates objects and injects then to our applications.
Benefits of USING SPRING FRAMEWORK:Following is the list of few of the great benefits of the using Spring Framework:
Spring enables developers to develop Enterprise-class applications using POJOs. The benefit of using only POJOs are so you don't need an EJB container product such as a application server but you hav E The option of using only a robust servlet container such as Tomcat or some commercial product. Spring is organized in a modular fashion. Even though the number of packages and classes is substantial, you has to worry only about ones you need and ignore the Rest. Spring does not reinvent the wheel instead, it truly makes use of some of the existing technologies like several ORM frame Works, logging frameworks, JEE, Quartz and JDK timers, other view technologies. Testing an application written with Spring are simple because environment-dependent code are moved into the this framework. Furthermore, by using the Javabean-style POJOs, it becomes easier to use dependency injection for injecting test data. Spring ' s web Framework is a well-designed web MVC framework, which provides a great alternative To web frameworks such as Struts or other over engineered or less popular web frameworks. Spring provides a convenient API to translate technology-specific exceptions (thrown by JDBC, Hibernate, or JDO, for Examp Le) into consistent, unchecked exceptions. Lightweight IoC containers tend to is lightweight, especially when compared to EJB containers, for example. This was beneficial for developing and deploying applications on computers with limited memory and CPU resources. Spring provides a consistent transaction management interface that can scale down to a local transaction (using a single D Atabase, for example) and the scale up-to-global transactions (using JTA, for example).
CONTENTS for SPRING FRAMEWORK Dependency injection in Spring Setting up Environment of Spring Hello Word Example in Spring Spring IoC Container What's Bean Factory in Spring application Context in Spring Constructor & Object Injecting injecting Inner Beans in Spring with Example injecting Collection in Spring Bean autowiring in Spring Understanding Bean Scopes Using Applicationcontextaware in Spring Bean Definition inheritance in Spring Bean Lifecycle and callbacks Writing a beanpostprocessor Writing a beanfactorypostprocessor Coding to Interfaces in Spring Introduction to Annotations and Based Configuration The autowired Annotation Some JSR-250 Annotations JSR Annotations in Spring
Component and stereotype Annotations Using Property Files by Messagesource in Spring Event Handling in Spring Introduction to AOP in Spring Setting up AOP Dependencies Writing First AspectJ program in Spring pointcuts and Wildcard Expressions joinpoints and Advice Arguments After Advice type and Around Advice type AOP XML Configuration Understanding AOP Proxies Spring JDBC Framework Using JdbcTemplate Implementing RowMapper DAO Support Classes Transaction Management Using Hibernate with Spring Spring Web MVC Framework Spring Logging with log4jSpring Batch Process with Example interview Questions on Spring Framework
Mock Questions for Spring certification
Spring Exam Simulator

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.