Spring Tutorial - Spring Introduction








Spring is a framework for building Java applications. We can use Spring to build any application in Java, for example, stand-alone, web, or Java Enterprise Edition (JEE) applications).

Spring's philosophy is minimal impact.

Spring is lightweight in the sense that we have to make few, if any, changes to your application code to gain the benefits of the Spring core.

Inverting Control or Injecting Dependencies

The core of the Spring Framework is based on the principle of Inversion of Control (IoC).

IoC is a technique that externalizes the creation and management of component dependencies.

Spring's Injecting Dependencies implementation is based on two core Java concepts:

  • JavaBeans
  • interfaces

The benefits of using DI rather than a more traditional approach:

  • Reduce glue code
  • Simplified application configuration
  • Manage common dependencies in a single repository
  • Improve testability
  • Promote good application design




Spring Features

Spring offers many modules, features and functions.

  • Aspect-Oriented Programming with Spring. AOP provides the ability to implement crosscutting logic, which applies to many parts of your application, in a single place.
  • Spring Expression Language. Expression Language (EL) allows us to manipulate Java objects at runtime.
  • Validation in Spring. Spring provides a built-in validation API by way of the Validator interface.
  • Accessing Data in Spring. Spring provides integration with a choice selection of these data access tools. In addition, Spring makes plain vanilla JDBC a viable option for many projects, with its simplified wrapper APIs around the standard API. Spring's data access module provides out-of-the-box support for JDBC, Hibernate, JDO, and the JPA.
  • Object/XML Mapping in Spring. Spring supports many common Java-to-XML mapping frameworks and, as usual, eliminates the need for directly coupling to any specific implementation.
  • Managing Transactions. Spring provides an abstraction layer for transaction management, allowing for programmatic and declarative transaction control.
  • Simplifying and Integrating with JEE
  • MVC in the Web Tier
  • WebSocket Support
  • Remoting Support
  • Mail Support
  • Job Scheduling Support
  • Dynamic Scripting Support
  • Simplified Exception Handling




Spring Modules

Spring version 4.0.2.RELEASE comes with 20 modules, packaged into 20 JAR files.

The following table describes these JAR files and their corresponding modules.

JAR FileDescription
aopSpring's AOP features
aspectsFor Advanced integration with the AspectJ AOP library.
beansFor Spring's manipulation of Spring beans.
contextProvide many extensions to the Spring core.
context-supportFurther extensions to the spring-context module.
coreCore module for every Spring application.
expressionSupport for Spring Expression Language (SpEL).
instrumentSpring's instrumentation agent for Java Virtual Machine (JVM) bootstrapping.
instrument-tomcatSpring's instrumentation agent for JVM bootstrapping in the Tomcat server.
jdbcFor JDBC support.
jmsFor JMS support.
messagingFor message-based applications and adds support for STOMP messages.
ormSpring's standard JDBC feature set with support for popular ORM tools including Hibernate, JDO, JPA.
oxmSupport for Object/XML Mapping (OXM).
testMock classes to aid in testing your applications.
txFor supporting Spring's transaction infrastructure.
webFor using Spring in your web applications
webmvcFor Spring's own MVC framework.
web-portletFor using Spring MVC in developing portlets for deployment to a portal server environment.
websocketFor the Java API for WebSocket (JSR-356).