Introduction to the architecture of the Java Spring Framework and installation configuration _java

Source: Internet
Author: User
Tags aop java web java spring framework

Architecture
Spring has the potential to be a one-stop service for all enterprise applications, however, spring is modular, allowing you to pick which modules are applicable without having to introduce the rest. The following sections give a detailed description of all the modules available in the Spring framework.

The spring Framework provides approximately 20 modules that can be used according to the requirements of your application.

Core container:
The core container consists of core, Beans, context and expression language modules, with details as follows:

The core modules provide the basic components of the framework, including IOC and dependency injection capabilities.

The Bean module provides beanfactory is a classic implementation of the factory pattern.

The context contexts module is built on a solid foundation provided by the core and Bean class modules, and it is the medium for accessing any object defined and configured. The ApplicationContext interface is the focus of the context module.

The expression Language module provides a powerful expression language for querying and manipulating object graphs at run time.

Data Access/Integration:
The data access/integration layer includes JDBC,ORM,OXM,JMS and transaction processing modules, with the following details:

The JDBC module provides an abstraction layer that is no longer required for verbose JDBC encoding related to JDBC.

The integration layer provided by the ORM module. Popular object-relational mapping APIs, including Jpa,jdo,hibernate and Ibatis.

The OXM module provides an abstraction layer that supports object/XML mapping implementations for Jaxb,castor, using XMLBEANS,JIBX and XStream.

The Java Messaging Service JMS module contains functionality for production and consumption information.

The transaction module supports programming and declarative transaction management to implement special interface classes, and for all Pojo.

Web:
The web layer includes the network, web-servlet,web-struts, and portlet components of the network, with details as follows:

The Web module provides the integration features of basic web development, such as the multi-file upload feature and the IOC container initialization and application context for the web used by the servlet listener.

The Web-servlet module contains spring's model-view-Controller (MVC) implementation Web application.

The Web-struts module contains a spring application within the support class that integrates the classic Struts Web layer.

The Web-portlet module provides the functionality of MVC to implement modules used in a Portlet environment and mirror the web's servlet.

Other:
There are other important modules, such as AOP, slicing, specification, network, and test modules, which are detailed below:

AOP modules provide an aspect-oriented programming implementation that allows you to define method interceptors and pointcuts, with cleanly decoupled, implemented functionality that should be separated from the code.

Aspects module provides integration with ASPECTJ This is also a powerful and sophisticated aspect-oriented programming (AOP) framework.

The instrumentation module provides support for the use of class tools and ClassLoader implementations in certain application servers.

The test module supports testing of the spring component using JUnit or TestNG frameworks.


installation Configuration
This tutorial will guide you through how to prepare your development environment and work with the Spring framework. This tutorial will also teach you how to install Jdk,tomcat and eclipse before installing the Spring framework:

Step 1th-Install the Java Development Kit (JDK):
Javase Download: The latest version of the SDK can be downloaded from Oracle Company's Java Web site. You will find instructions on how to install the JDK in the downloaded file and follow the instructions for installing and configuring the settings. Finally, set path and java_home environment variables to point to include Java and javac, usually Java_install_dir/bin and Java_install_dir directories respectively.

If you are running Windows and have JDK installed in c:jdk1.6.0_15, you can write the following line to the C:autoexec.bat file.

Set path=c:jdk1.6.0_15in;%path%
Set java_home=c:jdk1.6.0_15

Also, on Windows NT/2000/XP, you can right-click My Computer, select Properties, then advanced, and then environment variables. Then update the path value and press the OK button.

In Unix (Solaris and Linux, etc.), if the SDK is installed in/usr/local/jdk1.6.0_15 if the C shell is used, simply write the following to the. cshrc file.

Setenv path/usr/local/jdk1.6.0_15/bin: $PATH
setenv java_home/usr/local/jdk1.6.0_15

In addition, if you are using an integrated development environment (IDE), such as Borland Company's Jbuilder,eclipse,intellij idea or Sun one Studio, compile and run a simple program to verify that the IDE knows to install Java, Otherwise, the appropriate settings should be made.

Step 2-Install the Apache common Log API:
You can download the latest version of the Apache common Log API from here http://commons.apache.org/logging/. Once the download is installed, unzip the binary distribution to a convenient location. For example in c:commons-logging-1.1.1, in Linux/unix for/usr/local/commons-logging-1.1.1. The directory will have the following jar files and other supporting documents, etc.

Be sure to set the CLASSPATH variable correctly on this directory, otherwise you will be faced with problems running the application.

Step 3rd-Install the Eclipse integrated development environment
All the examples in this tutorial use the Eclipse IDE. So I suggest you should have the latest version of Eclipse installed on the machine.

Install the Eclipse IDE, http://www.eclipse.org/downloads/from the latest eclipse binaries. Once the download is installed, unpack the binaries and put them in a convenient location. For example, in C:eclipse, or/usr/local/eclipse, the path variable is finally properly set in Linux/unix.

Eclipse can be started by executing the following commands on a Windows machine, or you can simply double-click the Eclipse.exe

 %c:eclipseeclipse.exe

Eclipse can be started by executing a command machine that is under UNIX (Solaris and Linux, etc.):

$/usr/local/eclipse/eclipse

After successful startup, if everything works, it should show the following results:

Step 4th-Install the Spring Framework Library
Now, if everything works, you can continue to set the Spring framework. The following is a simple step to download and install the frame on the machine.

Select whether you want to install Spring on Windows or UNIX, and then proceed to the next step, and the download zip file applies to Windows and Unix as. tz files.

Http://www.springsource.org/download the latest version of the binaries from the downloaded Spring framework.

In writing this tutorial, I download Spring-framework-3.1.0.m2.zip in Windows, when decompressing the downloaded file, it directory structure: c:spring-framework-3.1.0.m2 as follows.

You will find all the spring libraries in the directory c:spring-framework-3.1.0.m2dist. Be sure to set the CLASSPATH variable correctly on this directory, otherwise you will be faced with problems running the application. If you are using eclipse then you do not need to set classpath because all of the settings will be completed through eclipse.


Related Article

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.