Suresh Rohan's Blog

This blog is all about Java, J2EE,Spring, Angular, React JS, NoSQL, Microservices, DevOps, BigData, Tutorials, Tips, Best practice, Interview questions, Views, News, Articles, Techniques, Code Samples, Reference Application and much more

Tuesday, June 9, 2015

Spring Basics

What is Spring Framework?


Light-weight yet comprehensive framework for building Java SE and Java EE applications.

Key Features - DI


JavaBeans-based configuration management, applying Inversion-of-Control principles, specifically using the Dependency Injection (DI) technique
         – This aims to eliminate manual wiring of components

A core bean factory, which is usable globally

Key Features - Persistence


Generic abstraction layer for database transaction management
Built-in generic strategies for JTA and a single JDBC DataSource
        – This removes the dependency on a Java EE environment for transaction support.
Integration with persistence frameworks Hibernate, JDO and iBATIS, and JPA.

Key Features - Web-Tier


MVC web application framework, built on core Spring functionality, supporting many technologies for generating views, including JSP, FreeMarker, Velocity, Tiles, iText, and POI(Java API to Access Microsoft Format files).
Web Flow - fine-grained navigation

Key Features - AOP


Extensive aspect-oriented programming (AOP) framework to provide services such as transaction management
       – As with the Inversion-of-Control parts of the system, this aims to improve the modularity of systems created using the framework.

Why Use Spring?


Wiring components (JavaBeans) through Dependency Injection
      – Promotes de-coupling among the parts that make up an application
Design to interfaces
      – Insulates a user of a functionality from implementation details
Test-Driven Development (TDD)
      – POJO classes can be tested without being tied up with the framework
Declarative programming through AOP
      – Easily configured aspects, esp. transaction support
Simplify use of popular technologies
      – Abstractions insulate application from specifics, eliminate redundant code
      – Handle common error conditions
      – Underlying technology specifics still accessible.
Conversion of checked exceptions to unchecked
      – (Or is this a reason not to use it?)
Not an all-or-nothing solution
      – Extremely modular and flexible
Well designed
      – Easy to extend
      – Many reusable classes
Integration with other technologies
      – EJB for J2EE
      – Hibernate, iBates, JDBC (for data access)
      – Velocity (for presentation)
      – Struts and WebWork (For web)
      – Java Persistence API (JPA)

Core Package


Core package is the most fundamental part of the framework and provides the Dependency
Injection container

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 you to decouple the configuration and specification of dependencies from your actual program logic

DAO Package


The DAO package provides a JDBC-abstraction layer that removes the need to do tedious JDBC
coding and parsing of database-vendor specific error codes

The JDBC package provides a way to do programmatic as well as declarative transaction management, not only for classes implementing special interfaces, but for all your POJOs (plain
old Java objects)


ORM Package


The ORM package provides integration layers for popular object-relational mapping APIs,
including JPA, JDO, Hibernate, iBatis, and JPA.

Using the ORM package you can use all those O/R-mappers in combination with all the other
features Spring offers, such as the simple declarative transaction management feature .


AOP Package


Spring's AOP package provides an AOP Alliance-compliant aspect-oriented programming implementation allowing you to define, for example, method-interceptors and pointcuts to
cleanly decouple code implementing functionality that should logically speaking be separated

Using source-level metadata functionality you can also incorporate all kinds of behavioral information into your code.

MVC Package


Spring's MVC package provides a Model-View- Controller (MVC) implementation for webapplications.

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 to use all the other features of
the Spring Framework.

Usage Scenarios


Typical Full-fledged Spring Web Application



Spring Middle-tier Using 3rd party Web Framework.



No comments:

Post a Comment