ITWissen.info - Tech know how online

Spring, framework

Spring is a comprehensive framework for the development of applications based on the Javaprogramming language. Especially in the context of the J2EE platform, Spring is a standard framework that is available as open source for all possible forms of Java applications. The background to the development of Spring was to realize a lightweight framework alternative to the often complex J2EE architectures. For this purpose, Spring is based on a POJO-oriented programming model. More complex architectures are easier to test when using Spring, and the source code is easier to maintain, so Spring has a lasting impact on the design of an application. At its core, Spring implements the concept of Dependency Injection( DI) and continues to incorporate the mechanisms of aspect-oriented programming( AOP).

The structures of Spring provide for the integrative use of other frameworks and standards such as Enterprise JavaBeans( EJB) or Hibernate - Spring is a meta-framework and can be integrated into the most diverse architectures due to its independence from a specific platform. Thus, Spring is used in many application servers such as Tomcat, Jetty, JBoss, Glassfish, etc. or standalone in its own environment. For this Spring also defines appropriate mechanisms for security. Distributed applications as well as distributed transactions are also possible because with the use of Spring a high reliability and a corresponding scalability are guaranteed. Under the links below the Spring Framework is available for download as well as a lot of further information about Spring.

The history of Spring

A short history of Spring: It started with a framework called interface21, which was published by Rod Johnson in his book "Expert One-on-One J2EE Design and Development", and was intended to support his own applications. Due to the high response, the open source project Spring was created from this in February 2003. The project is hosted at Sourceforge and currently employs a number of developers to further develop and support Spring. The current version of the framework is available at the link below. Among them you can also find other projects that have been developed in the Spring environment. In particular, for example, a version ported to the . NET platform is also available. Here is a short overview of other projects:

  • Spring Webs Service for the realization of web services.
  • Spring Security for the realization of security aspects in Java and web applications.
  • Spring LDAP for the realization of access to LDAP systems.
  • Spring Rich Client for the realization of rich client applications based on Spring.
  • Spring Modules with a summary of tools and extensions for Spring.

More projects are available via the links below.

The framework of Spring

Spring is typically described as a so-called lightweight framework for building Java applications. Beyond that, however, it must be added:

  • The Spring framework can be used for all kinds of conceivable Java applications.
    Architecture of a typical Spring-based web application

    Architecture of a typical Spring-based web application

    For example, it is not limited to web applications like Apache 's Struts framework. The figure shows an example of the architecture of a typical Spring-based web application.
  • Lightweight in this context means that only minimal adjustments to the existing source code are required in order to use Spring to advantage.

At its core, Spring relies on technologies such as interfaces and dependency injection (DI), which complement each other. Based on interfaces, a mesh of a decoupled architecture of the application is created. If Dependency Injection is also used, the configuration of the dependencies takes place outside the code. Dependency Injection can then be used to greatly reduce the amount of code in an interface-based design, which consequently prevents tight coupling of system components. Spring acts in the context of Dependency Injection as a container. This provides fully configured instances of the classes of an application with all their dependencies of the application.

Using the Spring framework can result in the following architectural advantages:

  • Applications can be subjected to unit tests without further effort.
  • Spring provides a consistent framework for accessing data. For this purpose, Java Database Connection( JDBC) or ORM products(Object-Relational Mapping) such as Hibernate, Toplink or Java Data Objects( JDO) can be used.
  • Spring is an alternative to Enterprise JavaBeans (EJB) and uses mechanisms of the aspect-oriented programming and offers thus a declarative transaction management under renouncement of an EJB container.
  • Spring offers the developer a defined framework on all levels for his development.
  • Business interfaces can be implemented as simple Java classes, the Plain Old Java Objects (POJO).

The central point of Spring is to make J2EE development easier and to support good programming practices. This includes that Spring as a meta-framework supports the integration of other frameworks, for example for persistence. At the same time, Spring is portable beyond the boundaries of application servers. The background is that Spring consistently dispenses with platform-specific and non-standard components.

Overview of the Spring modules

Overview of the Spring modules

The figure shows the arrangement and distribution of Spring's functionalities and features across seven different modules. This covers all functions for the development of enterprise-wide applications. However, an application does not have to be based entirely on the Spring framework. The developer is free to choose the modules that are most useful in his specific environment. As shown in the figure, the central module is the Spring Core - this provides a container with the basic functions. Here, Spring is referred to as Beans, meaning all the resources managed by Spring. The central element of every Spring application is the BeanFactory - an implementation of the pattern factory. This uses the Inversion of Control ( IoC) principle to separate the application configuration from the specification of code dependencies.

Spring Context Module Extends the BeanFactory concept to include life-cycle events, validation, EJB integration, remoting, and scheduling. The BeanFactory implements the container and the Context Module implements the framework-specific part.

Spring AOP Module Supports aspect-oriented programming (AOP) of custom aspects for Spring-based applications. It also enables metadata programming in Spring. To implement interoperability with other AOP frameworks, Spring AOP realization is largely based on the interface defined by the AOP Alliance.

Spring DAO Module The module abstracts the Java Database Connectivity (JDBC) interfaces so that the actual technical code to establish data connections, handle statements, results or errors, for example, is moved to the classes of the framework. This allows the application code to focus purely on the application. To provide transaction management services for the objects of a Spring application, the DAO module in turn uses the capabilities of the AOP module.

Spring ORM Module ORM stands for object-relational mapping - this refers to the mapping of objects to relational databases. With this module, Spring integrates popular ORM frameworks such as Hibernate, TopLink, JDO and iBATISSQL Maps. However, transaction management services are also available in this module.

Spring Web Module Provides a context for the realization of web-based applications. Furthermore, this module integrates the Struts framework.

Spring Web MVC Module Contains a complete MVC framework for the realization of web applications and thus competes with other web application frameworks. The difference is, however, that Spring with Model View Controller (MVC) while using the Inversion of Control (IoC) has advantages in terms of flexibility and decoupling of components compared to other frameworks such as Struts.

In practice, the Spring framework is often part of the development of an application because it provides this large amount of functionality. In addition, the integration of persistence technologies and declarative transaction management are supported in particular, so that Spring is also used for database applications.

Informations:
Englisch: Spring, framework
Updated at: 01.04.2010
#Words: 1240
Links: framework, Java 2 enterprise edition (J2EE), platform, standard (STD), Java
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024