Spring Framework
개발원SpringSource
최신 버전3.0.6 (2011 년 8 월 23 일 (4 개월 전))
지원 OS각종
플랫폼Java 가상 머신
종류애플 리케이션 프레임 워크
공식 사이트http://www.springframework.org
템플릿을 표시

Spring Framework 는 Java 플랫폼 을위한 오픈 소스 애플 리케이션 프레임 워크 이다. 단순히 Spring 라고도 불린다.Rod Johnson이 자기 저서 Expert One - on - One J2EE Design and Development (Wrox Press, 2002 년 10 월)와 함께 선보인 것이 최초이다. . NET Framework 를위한 포팅도있다 [1] . 2006 년 Spring Framework 1.2.6는 Jolt productivity award를 수상했다 [2] .

Spring Framework는 특정 프로그래밍 모델 을 강제하는 것은 아니지만, Java 커뮤니티에서는 Enterprise JavaBeans (EJB) 모델의 대체 치환 추가로 널리 인정되고있다. 디자인이 프레임 워크는 Java 개발자의 자유도를 높게하고 있지만 문서가 풍부하고 잘 상황에 사용할 사용하기 쉬운 솔루션을 제공한다.

Spring Framework의 핵심 기능은 모든 Java 응용 프로그램에서 사용할 수 있지만, Java Platform, Enterprise Edition 에 Web 기반 응용 프로그램을 구축하기위한 확장 및 개선이 풍부하게 포함되어있다. 그 용도로 Spring을 사용할 수 많아 주목 받고있다. [3]

첫 번째 릴리스는 2003 년 6 월, Apache License 2.0 라이센스 있었다. 1.0이 출시된 것은 2004 년 3 월이다.

목차

  [ 숨기기 ] 

개요 편집 ]

Spring Framework는 Java 플랫폼 에 따라 응용 프로그램을 만들려고하는 Java 개발자와 조직이 직면한 과제에 대한 해결책을 준다. Spring Framework는 Java EE 단지와 연결되어있는 것이 아니라 광범위한 통합이 가능하며, 그것이 널리 채용되고있는 중요한 이유이기도하다.

Spring Framework는 기존적인 프로그래밍 모델을 사용하지 않고 효율적으로 복잡한 응용 프로그램을 만드는 데 필요한 기능을 제공한다. 또한, Java 플랫폼에도 색다른 기능을 재빨리 도입 것도 알려져있다.

Spring Framework는 일관된 모델을 제공하고 그 모델을 Java 플랫폼에서 만들어진 다양한 애플 리케이션에 적용할 수있는 프레임 워크이다.

모듈 편집 ]

Spring Framework는 작은 프레임 워크의 집합체라고 볼 수있다. 이러한 프레임 워크의 대부분은 혼자 작동하도록 설계되고 있지만, 함께 사용하면 더 나은 기능을 제공한다. 각 프레임 워크는 일반적으로 복잡한 응용 프로그램 구성 요소에 따라 분할되어있다.

  • Inversion of Control 컨테이너 : 응용 프로그램 구성 요소의 구성 과 Java 객체의 라이프 사이클 관리
  • aspect 지향 프로그래밍 프레임 워크 : Java의 객체 지향 프로그래밍 기능은 무언가를 희생하지 않으면 구현할 수없는 기능을 다룬다.
  • 데이터 액세스 프레임 워크 : JDBC 와 객체 관계 매핑 도구를 사용하여 데이터베이스 관리 시스템 관련을 취급하고 재사용 가능한 솔루션을 제공한다.
  • 트랜잭션 관리 프레임 워크 : 각종 트랜잭션 관리 API를 조화시켜 Java 오브젝트를위한 트랜잭션 관리를 통합한다.
  • Model View Controller 프레임 워크 : HTTP 와 Servlet 기반 프레임 워크 확장 및 사용자 지정을위한 다수의 연결을 제공하고있다.
  • 원격 액세스 프레임 워크 : RPC 적인 Java 오브젝트 가져오기 및 내보내기 기능. RMI , CORBA , Web 서비스 등 HTTP 기반 프로토콜 ( SOAP ) 등을 지원합니다.
  • 인증 · 승인 프레임 워크 : Spring Security 하위 프로젝트의 결과물을 사용한 인증 및 권한 부여의 통합. 각종 표준 프로토콜 도구 등을 지원합니다.
  • 원격 관리 프레임 워크 : JMX 를 사용하여 로컬 및 원격 Java 객체의 구성 관리.
  • 메시지 프레임 워크 : JMS (표준 JMS API를 개량)을 사용하여 메시지 대기열 에서 투명하게 메시지를 소비하는 메시지 리스너 객체를 등록.
  • 테스트 프레임 워크 : 단위 테스트와 통합 테스트를 작성하기위한 클래스 군을 지원합니다.
  • 배치 처리 프레임 워크 : 대량의 데이터를 일괄 처리하기위한 모듈을 제공합니다.

Inversion of Control 컨테이너 편집 ]

Spring Framework의 핵심은 Inversion of Control 컨테이너이며 콜백 을 사용하여 Java 객체의 구성 및 관리 일관된 방법을 제공한다. 이 컨테이너는 BeanFactory ,ApplicationContext , Core container 라고도한다.

이 컨테이너는 많은 책임과 확장 지점을 가지고 있으며, 그들이 모든 Inversion of Control을 형성한다고 볼 수있다 (따라서 이렇게 부른다). 예를 들어, 객체 생성, 객체의 구성 초기화 메서드 호출 등록된 콜백 개체에 개체를 전달 등이다. 컨테이너의 많은 기능이 객체의 라이프 사이클 형성에 관계 그것은 컨테이너가 제공하는 가장 중요한 기능 중 하나이다.

이 컨테이너가 생성하는 객체를 Managed Objects 또는 Beans 라고 부른다. 일반적으로 Bean definitions 를 포함하는 XML 파일을로드하면 컨테이너가 구성한다. 이 파일에는 객체 생성에 필요한 모든 정보가있다. 객체가 생성되고 구성시 오류가 발생하지 않은 경우 사용 가능한 상태가된다.

개체를 가져오려면 "의존성 참조"또는 " 의존성 주입 "을 실시한다. "의존성 참조"는 호출자가 컨테이너 개체에 대해 이름과 형식을 지정하여 개체에 대해 문의 패턴이다."의존성 주입"는 컨테이너가 생성자 또는 속성 또는 Factory 메서드 를 사용하여 다른 객체 이름으로 객체를 전달 패턴이다.

많은 경우이 컨테이너를 사용하지 않고 Spring Framework의 다른 부분만을 사용하는 것은 가능하지만,이 컨테이너를 사용하여 응용 프로그램의 구성과 사용자가 쉽게된다. Spring 컨테이너는 일관된 응용 프로그램의 구성 메커니즘을 제공하고 작은 응용 프로그램에서 큰 것까지 거의 모든 환경에서 작동한다.

Pitchfork 프로젝트의 결과물을 사용하면이 컨테이너를 EJB3 컨테이너 부분으로 준수시킬 수있다. Spring Framework가 표준을 준수하지 않는 점을 비판하는 사람도있다. 그러나 SpringSource 는 EJB3 준수를 최종 목표로 생각 않고, Spring Framework와 컨테이너가 더 강력한 프로그래밍 모델이라고 주장하고있다 [4] .

aspect 지향 프로그래밍 프레임 워크 편집 ]

Spring Framework에는 자기 부담의 AOP 프레임 워크가 "화면"의 클래스 사이를 횡단하는 기능 ( 횡단적 관심사 )의 모듈화한다. 자신의 AOP 프레임 워크를 만드는 동기는 설계에서도 구현에서도 구성에서도 너무 ​​복잡 불과 기본적인 AOP 기능을 제공할 수 있다고 생각했기 때문이다. Spring AOP 프레임 워크는 Spring 컨테이너를 활용하고있다.

Spring AOP 프레임 워크는 기본적으로 차단 방식이며 런타임에 구성된다. 따라서 컴파일시와로드시에 반영 (weaving) 필요 없다. 한편, 차단은 조인트 포인트 에있는 개체의 public 또는 protected 메서드 밖에 대상이 될 수 없다.

AspectJ 와 비교하면 Spring AOP는 무력하지만 단순하다. Spring 1.2에서는 AspectJ aspect를 컨테이너에 구성할 수있다. Spring 2.0에서는 또한 AspectJ와의 연계를 강화하고 예를 pointcut 언어가 유용되고있다.

Spring AOP는 Spring Framework 자체의 횡단적인 관심사에 대해서도 작동한다. 컨테이너를 사용하여 생성된 구성되는 모든 개체에 Spring AOP를 사용하여 품질을 향상시킬 수있다.

Spring Framework는 트랜잭션 관리, 보안, 원격 액세스, JMX 등의 부분에 Spring AOP를 사용하고있다.

버전 2.0 이후 Spring은 AOP의 구성 방법을 두 가지 제공하고있다.

  • 스키마 기반 기술
  • @ AspectJ 기반의 주석 스타일

Spring 팀은 새로운 AOP 관련 용어를 도입하지 않는 것을 결정했다. 따라서, Spring 문서에 나오는 AOP 관련 용어는 AspectJ 등과 같은 것만이다.

데이터 액세스 프레임 워크 편집 ]

Spring의 데이터 액세스 프레임 워크는 응용 프로그램에서 데이터베이스를 이용하고자 할 때 개발자가 직면하는 문제를 해결한다. Java의 기본 데이터 액세스 프레임 워크를 모두 제공하고있다. 즉, JDBC , iBATIS , Hibernate , JDO , JPA , Oracle TopLink , Apache OJB [1 ] Apache Cayenne [2] 등이다.

이러한 프레임 워크를 Spring은 다음 기능을 제공한다.

  • 자원 관리 - 데이터베이스 리소스의 자동 획득 해제
  • 예외 처리 - 데이터 액세스할 때 예외를 Spring 데이터 액세스 계층으로 변환
  • 트랜잭션 참여 - 실행중인 트랜잭션에 대한 트랜잭션 참여
  • 리소스 제거 포장 - 커넥션 풀링 래퍼에서 데이터베이스 개체를 꺼낸다.
  • BLOB 및 CLOB 처리를위한 추상화

이 기능은 Spring 각 프레임 워크에 제공하는 Template 클래스를 사용하면 이용 가능하다. 이 Template 은 무용이다 (예를 들면) Hibernate API를 직접 사용하는 것과 비교하여 어떤 장점도 없다는 비판도있다 [5] . 그것에 따라, Spring은 Hibernate와 JPA 의 API를 직접 사용할 수 있도록했다. 그러나이 경우 위의 기능이 제공되지 않으므로 응용 프로그램에서 모두 처리하여야한다.

Spring의 트랜잭션 관리와 함께 데이터 액세스 프레임 워크를 사용하여 각종 데이터 액세스 프레임 워크의 유연한 추상화가 가능하게된다. Spring Framework는 일반적인 데이터 액세스 API는 제공하고 있지 않다. 대신 지원하는 API를 거의 그대로 사용할 수 있도록하고있다.

트랜잭션 관리 프레임 워크 편집 ]

Spring의 트랜잭션 관리 프레임 워크는 Java 플랫폼 추상화 메커니즘이있다. 다음과 같은 추상화가 가능하다.

  • 로컬 트랜잭션과 글로벌 트랜잭션 추상화 (로컬 트랜잭션은 애플 리케이션 서버 는 제외)
  • 중첩 트랜잭션 추상화
  • 트랜잭션의 안전한 지점의 추상화
  • 거의 모든 Java 플랫폼 환경에서 추상화

JTA 와 비교하면 JTA는 중첩 글로벌 트랜잭션을 지원하고 응용 프로그램 서버 가 필수이다 (경우에 따라 응용 프로그램 서버에 응용 프로그램 배포도 필요).

Spring Framework는 다음과 같은 트랜잭션 관리 전략을위한 PlatformTransactionManager 가있다.

추상화기구 이외에이 프레임 워크는 응용 프로그램 트랜잭션 관리 기능을 부여하는 두 가지 방법을 제공한다.

  • 프로그래밍. Spring의 TransactionTemplate 을 사용한다.
  • 구성. XML 또는 Java 5 주석 과 같은 메타 데이터 를 사용한다.

Spring의 데이터 액세스 프레임 워크와 함께 사용하면 JTA와 EJB 를 사용하지 않고 트랜잭션 시스템의 구성에 의한 설정이 가능하다. Java Message Service 와 캐시 엔진도 함께있다.

Model - View - Controller 프레임 워크 편집 ]

Spring Framework는 당초 계획에는 없었던, 자기 부담의 MVC 프레임 워크가있다. 자기 부담의 Web 프레임 워크를 만들기로 한 것은 아파치 Struts 웹 프레임 워크에 실망 때문이며 [6] 다른 프레임 워크는 부족했기 때문에이다. 개발자들은 특히 프레 젠 테이션 계층과 요청 처리 층의 분리 요청 처리 계층 모델의 분리가 불충분하다고 판단했다 [7] .

Struts와 마찬가지로 Spring MVC는 클레임 기반 프레임 워크이다. 이 프레임 워크는 최근 수요 기반 프레임 워크는 필수가되고있는 모든 책임에 대해 Strategy 인터페이스를 정의하고있다. 각 인터페이스의 책임 충분히 간단하기 때문에 구현을 작성하는 것은 쉽다. 인터페이스는 Servlet API 와 밀접하게 결합하고 그 API의 능력을 최대한 발휘할 수있다. 이 Servlet API 와 밀접하게 결합하기 때문에 Web 응용 프로그램의 고급 추상화 수 없다고 지적하는 사람도있다. 그러나이 결합이 덕분에 Servelet API의 기능을 사용자가 사용할 수 동시에 고도로 추상화된 프레임 워크를 제공하고있다.

DispatcherServlet 클래스는 프레임 워크의 Front Controller [8] 이며, HTTP 요청을 처리하는 동안 각종 인터페이스 제어를 위임한다.

Spring MVC 정의하는 인터페이스 중에서도 다음의 것이 중요하다.

  • HandlerMapping : 어떤 속성이나 조건에 따라 들어온 요청을 처리하는 객체 (핸들러)를 선택한다.
  • HandlerAdapter : 들어온 요청을 처리하는 개체를 실행한다.
  • Controller : Model과 View 사이에서하고 들어온 요청을 관리하고 적절한 응답에 리디렉션합니다.
  • View : 클라이언트에 응답을 돌려 준다.
  • ViewResolver : 뷰의 논리적 이름에 따라 View를 선택한다 (필수는 아니다).
  • HandlerInterceptor : 들어온 요청을 차단한다. Servlet 필터와 유사하지만 동일하지 않습니다 (옵션이고 DispatcherServlet 에 의해 제어되지 않는다).
  • LocaleResolver : 개별 사용자의 로케일 을 해결하고 옵션에서 세이브도한다.
  • MultipartResolver : 들어온 요청을 포장하여 파일 업로드를 쉽게한다.

각 strategy 인터페이스는 전체 프레임 워크에서 중요한 책임이있다. 이러한 인터페이스가 제공하는 추상화는 매우 강력하고 구현은 다양한 변형이 가능하다. Spring MVC는이 인터페이스의 구현도 포함되어 있지만, 개발자와 벤더가 새로운 구현을 쓸 수도있다. Spring MVC는 Java의 java.util.Map 인터페이스를 Model 위한 데이터 지향 추상화로 사용하고 있으며, 키는 문자열 값이어야한다.

이러한 인터페이스 구현 테스트를 쉽게 할 수있는 점은 Spring MVC의 고급 추상화의 중요한 장점 중 하나이다. DispatcherServlet 은 Spring inversion of Control 컨테이너와 밀접하게 결합되어 응용 프로그램의 Web 계층 구성이 가능하다. 그러나 Spring Framework의 다른 부분 (컨테이너 포함)을 사용한 응용 프로그램에서 Spring MVC를 사용한다는 선택도 가능하다.

Spring MVC는 Spring 컨테이너를 구성 및 조립에 사용하고 있기 때문에, Web 기반 응용 프로그램 Inversion of Control 기능의 장점을 십분 활용할 수있다.

원격 액세스 프레임 워크 편집 ]

Spring의 원격 액세스 프레임 워크는 Java 플랫폼 에서 사용할 수있는 RPC 기반의 각종 기술에 대한 추상화이고 클라이언트 연결 및 서버 사이의 개체 내보내기에서 모두 사용할 수있다. 그 중에서도 가장 중요한 기능은 Inversion of Control 및 AOP 와의 조합으로 그들 기술의 구성과 이용을 가능한 한 쉽게하는 점이다.

이 프레임 워크는 또한 장애 복구 (연결 실패 후 자동 재연결)와 클라이언트에서 EJB 원격 stateless 세션 Bean에 대한 최적화도 제공하고있다.

Spring은 다음과 같은 프로토콜 및 다른 제품과의 연결을 지원하고있다.

  • HTTP 기반의 프로토콜
    • Hessian : 바이너리 방식의 직렬 프로토콜. 오픈 소스.
    • RMI (1) : RMI 기초로 메서드 호출한다. 그러나 Spring 특정 방식.
    • RMI (2) : RMI를 사용하여 메서드 호출한다. 보통의 RMI 인터페이스에 따릅니다.
    • RMI - IIOP ( CORBA ) : RMI-IIOP/CORBA를 사용한 메소드 호출.
  • Enterprise JavaBeans 클라이언트 연결
    • 로컬 EJB 무상태 세션 Bean 연결 : 로컬 Stateless 세션 Bean과 연결한다.
    • 원격 stateless 세션 Bean 연결 : 원격 stateless 세션 Bean과 연결한다.
  • SOAP

Xfire SOAP 프레임 워크는 Spring Framework와 함께 서버의 객체를 RPC 스타일로 내보내는 기능을 제공한다.

Spring의 원격 액세스 프레임 워크를 지원하는 RPC 스타일의 프로토콜 및 제품에 대한 클라이언트 서버도 설정을 Spring Core 컨테이너 할 수있다 ( Apache Axis 제외).

대체 오픈 소스 구현으로 Cluster4Spring 가있다. 이것은 일대일, 일대다, 동적 서비스 발견 등의 다양한 구성을 지원하는 것을 의도한 것이다.

배치 처리 프레임 워크 편집 ]

2008 년 4 월에 정식 버전이 출시된 일괄 처리의 Spring 프레임 워크 모듈 군. Infrastructure와 Core 두 가지 모듈로 구성되고, 대량의 데이터를 일괄 처리할 수있다. Ver1.0은 Java1.4 단일 프로세스 다중 스레드를 타겟으로하고 있었지만, Ver2.0에서는 Java1.5 이상에서 동작하며, 멀티 프로세스에 대응했다.


각주 편집 ]

  1. ^ Spring.NET - Application Framework
  2. ^ Jolt winners 2006
  3. ^ Spring OSTATIC
  4. ^ Pitchfork FAQ " 2006 년 6 월 6 일 보기.
  5. ^ Hibernate hates Spring
  6. ^ Introduction to the Spring Framework by Rod Johnson
  7. ^ Johnson, Expert One - on - One J2EE Design .. , Ch 12. et al.
  8. ^ Front Controller MartinFowler.com

참고 문헌 편집 ]

  • Johnson, Rod ; Jürgen Höller, Alef Arendsen, Thomas Risberg, and Colin Sampaleanu (2005 년). Professional Java Development with the Spring Framework . Wiley. ISBN 0-7645-7483-3 . 
  • Harrop, Rob ; Jan Machahek (2005 년) Pro Spring . APress. ISBN 1-59059-461-4 . 
  • Johnson, Rod ; Jürgen Höller (2004 년) J2EE Development without EJB . Wiley. ISBN 0-7645-5831-5 . 
  • Johnson, Rod (2002 년) Expert One - on - one J2EE Design and Development . Wiley. ISBN 0-7645-4385-7 . 
  • Walls, Craig ; Ryan Breidenbach (2005 년) Spring in Action . Manning. ISBN 1-932394-35-4 . 
  • Wolff, Eberhard (2006 년) Spring - Framework für die Java Entwicklung . dpunkt. ISBN 3-89864-365-4 . 

외부 링크 편집 ]

다른 IoC / DI 프레임 워크 편집 ]

기타 편집 ]


==============================================================================================

The Spring Framework is an open source application framework and Inversion of Control container for theJava platform.[1]

The first version was written by Rod Johnson, who released the framework with the publication of his bookExpert One-on-One J2EE Design and Development in October 2002. The framework was first released under the Apache 2.0 license in June 2003. The first milestone release, 1.0, was released in March 2004, with further milestone releases in September 2004 and March 2005. The Spring 1.2.6 framework won a Jolt productivity award and a JAX Innovation Award in 2006.[2][3] Spring 2.0 was released in October 2006, Spring 2.5 in November 2007, Spring 3.0 in December 2009, and Spring 3.1 in December 2011. The current version is 3.1.0.[4]

The core features of the Spring Framework can be used by any Java application, but there are extensions for building web applications on top of the Java EE platform. Although the Spring Framework does not impose any specific programming model, it has become popular in the Java community as an alternative to, replacement for, or even addition to the Enterprise JavaBean (EJB) model.

Contents

  [hide

[edit]Modules

The Spring Framework comprises several modules that provide a range of services:

[edit]Inversion of Control container (Dependency injection)

Central to the Spring Framework is its Inversion of Control container, which provides a consistent means of configuring and managing Java objects usingreflection. The container is responsible for managing object lifecycles: creating objects, calling initialization methods, and configuring objects by wiring them together.

Objects created by the container are also called Managed Objects or Beans. Typically, the container is configured by loading XML files containing Bean definitions which provide the information required to create the beans.

Objects can be obtained by means of Dependency lookup or Dependency injectionDependency lookup is a pattern where a caller asks the container object for an object with a specific name or of a specific type. Dependency injection is a pattern where the container passes objects by name to other objects, via either constructors, properties, or factory methods.

In many cases one need not use the container when using other parts of the Spring Framework, although using it will likely make an application easier to configure and customize. The Spring container provides a consistent mechanism to configure applications and integrates with almost all Java environments, from small-scale applications to large enterprise applications.

The container can be turned into a partially-compliant EJB3 container by means of the Pitchfork project. Some[who?] criticize the Spring Framework for not complying with standards.[5] However, SpringSource doesn't see EJB3 compliance as a major goal, and claims that the Spring Framework and the container allow for more powerful programming models.[6]

[edit]Aspect-oriented programming framework

The Spring Framework has its own AOP framework which modularizes cross-cutting concerns in aspects. The motivation for creating a separate AOP framework comes from the belief that it would be possible to provide basic AOP features without too much complexity in either design, implementation, or configuration. The Spring AOP framework also takes full advantage of the Spring Container.

The Spring AOP framework is interception based, and is configured at run time. This removes the need for a compilation step or load-time weaving. On the other hand, interception only allows for public method-execution on existing objects at a join point.

Compared to the AspectJ framework, Spring AOP is less powerful but also less complicated. Spring 1.2 includes support to configure AspectJ aspects in the container. Spring 2.0 added more integration with AspectJ; for example, the pointcut language is reused and can be mixed with SpAOP-based aspects. Further, Spring 2.0 added a Spring Aspects library which uses AspectJ to offer common Spring features such as declarative transaction management and dependency injection via AspectJ compile-time or load-time weaving. SpringSource also uses AspectJ for AOP in other Spring projects such as Spring Rooand Spring Insight, with Spring Security also offering an AspectJ-based aspect library.

Spring AOP has been designed to make it able to work with cross-cutting concerns inside the Spring Framework. Any object which is created and configured by the container can be enriched using Spring AOP.

The Spring Framework uses Spring AOP internally for transaction management, security, remote access, and JMX.

Since version 2.0 of the framework, Spring provides two approaches to the AOP configuration:

  • schema-based approach.
  • @AspectJ-based annotation style.

The Spring team decided not to introduce new AOP-related terminology; therefore, in the Spring reference documentation and API, terms such as aspectjoin pointadvicepointcut, introduction, target object (advised object), AOP proxy, and weaving all have the same meanings as in most other AOP frameworks (particularly AspectJ).

[edit]Data access framework

Spring's data access framework addresses common difficulties developers face when working with databases in applications. Support is provided for all popular data access frameworks in Java: JDBCiBatis / MyBatisHibernateJDOJPAOracle TopLinkApache OJB, and Apache Cayenne, among others.

For all of these supported frameworks, Spring provides these features

  • Resource management - automatically acquiring and releasing database resources
  • Exception handling - translating data access related exception to a Spring data access hierarchy
  • Transaction participation - transparent participation in ongoing transactions
  • Resource unwrapping - retrieving database objects from connection pool wrappers
  • Abstraction for BLOB and CLOB handling

All these features become available when using Template classes provided by Spring for each supported framework. Critics say these Template classes are intrusive and offer no advantage over using (for example) the Hibernate API directly.[7][not in citation given] In response, the Spring developers have made it possible to use the Hibernate and JPA APIs directly. This however requires transparent transaction management, as application code no longer assumes the responsibility to obtain and close database resources, and does not support exception translation.

Together with Spring's transaction management, its data access framework offers a flexible abstraction for working with data access frameworks. The Spring Framework doesn't offer a common data access API; instead, the full power of the supported APIs is kept intact. The Spring Framework is the only framework available in Java which offers managed data access environments outside of an application server or container.[citation needed]

While using Spring for transaction management with Hibernate, the following beans may have to be configured

Other configurations

  • AOP configuration of cutting points using <aop:config>
  • Transaction semantics of AOP advice using <tx:advice>

[edit]Transaction management framework

Spring's transaction management framework brings an abstraction mechanism to the Java platform. Its abstraction is capable of:

In comparison, JTA only supports nested transactions and global transactions, and requires an application server (and in some cases also deployment of applications in an application server).

The Spring Framework ships a PlatformTransactionManager for a number of transaction management strategies:

  • Transactions managed on a JDBC Connection
  • Transactions managed on Object-relational mapping Units of Work
  • Transactions managed via the JTA TransactionManager and UserTransaction
  • Transactions managed on other resources, like object databases

Next to this abstraction mechanism the framework also provides two ways of adding transaction management to applications:

Together with Spring's data access framework — which integrates the transaction management framework — it is possible to set up a transactional system through configuration without having to rely on JTA or EJB. The transactional framework also integrates with messaging and caching engines.

[edit]Model-view-controller framework

The Spring Framework features its own MVC web application framework, which wasn't originally planned. The Spring developers decided to write their own web framework as a reaction to what they perceived as the poor design of the (then) popular Jakarta Struts web framework[8], as well as deficiencies in other available frameworks. In particular, they felt there was insufficient separation between the presentation and request handling layers, and between the request handling layer and the model.[9]

Like Struts, Spring MVC is a request-based framework. The framework defines strategy interfaces for all of the responsibilities which must be handled by a modern request-based framework. The goal of each interface is to be simple and clear so that it's easy for Spring MVC users to write their own implementations if they so choose. MVC paves the way for cleaner front end code. All interfaces are tightly coupled to the Servlet API. This tight coupling to theServlet API is seen by some as a failure on the part of the Spring developers to offer a high-level abstraction for web-based applications[citation needed]. However, this coupling makes sure that the features of the Servlet API remain available to developers while offering a high abstraction framework to ease working with said API.

The DispatcherServlet class is the front controller[10] of the framework and is responsible for delegating control to the various interfaces during the execution phases of a HTTP request.

The most important interfaces defined by Spring MVC, and their responsibilities, are listed below:

  • HandlerMapping: selecting objects which handle incoming requests (handlers) based on any attribute or condition internal or external to those requests
  • HandlerAdapter: execution of objects which handle incoming requests
  • Controller: comes between Model and View to manage incoming requests and redirect to proper response. It essentially is like a gate that directs the incoming information. It switches between going into model or view.
  • View: responsible for returning a response to the client. It is possible to go straight to view without going to the model part. It is also possible to go through all three.
  • ViewResolver: selecting a View based on a logical name for the view (use is not strictly required)
  • HandlerInterceptor: interception of incoming requests comparable but not equal to Servlet filters (use is optional and not controlled by DispatcherServlet).
  • LocaleResolver: resolving and optionally saving of the locale of an individual user
  • MultipartResolver: facilitate working with file uploads by wrapping incoming requests

Each strategy interface above has an important responsibility in the overall framework. The abstractions offered by these interfaces are powerful, so to allow for a set of variations in their implementations, Spring MVC ships with implementations of all these interfaces and together offers a feature set on top of theServlet API. However, developers and vendors are free to write other implementations. Spring MVC uses the Java java.util.Map interface as a data-oriented abstraction for the Model where keys are expected to be string values.

The ease of testing the implementations of these interfaces seems one important advantage of the high level of abstraction offered by Spring MVC.DispatcherServlet is tightly coupled to the Spring Inversion of Control container for configuring the web layers of applications. However, web applications can use other parts of the Spring Framework—including the container—and choose not to use Spring MVC.

[edit]Remote access framework

Spring's Remote Access framework is an abstraction for working with various RPC-based technologies available on the Java platform both for client connectivity and exporting objects on servers. The most important feature offered by this framework is to ease configuration and usage of these technologies as much as possible by combining Inversion of Control and AOP.

The framework also provides fault-recovery (automatic reconnection after connection failure) and some optimizations for client-side use of EJB remote stateless session beans.

Spring provides support for these protocols and products out of the box:

  • HTTP-based protocols
    • Hessian: binary serialization protocol, open-sourced and maintained by CORBA-based protocols
    • RMI (1): method invocations using RMI infrastructure yet specific to Spring
    • RMI (2): method invocations using RMI interfaces complying with regular RMI usage
    • RMI-IIOP (CORBA): method invocations using RMI-IIOP/CORBA
  • Enterprise JavaBean client integration
    • Local EJB stateless session bean connectivity: connecting to local stateless session beans
    • Remote EJB stateless session bean connectivity: connecting to remote stateless session beans
  • SOAP
    • Integration with the Apache Axis web services framework

Apache CXF provides integration with the Spring Framework for RPC-style exporting of object on the server side.

Both client and server setup for all RPC-style protocols and products supported by the Spring Remote access framework (except for the Apache Axissupport) is configured in the Spring Core container.

There is alternative open-source implementation (Cluster4Spring) of a remoting subsystem included into Spring Framework which is intended to support various schemes of remoting (1-1, 1-many, dynamic services discovering).

[edit]Convention-Over-Configuration Rapid Application Development

Spring Roo is Spring's Convention-over-configuration solution for rapidly building applications in Java. It currently supports Spring Framework, Spring Security and Spring Web Flow, with remaining Spring projects scheduled to be added in due course. Roo differs from other rapid application developmentframeworks by focusing on:

  • Java platform productivity (as opposed to other languages)
  • Usability (particularly via the shell features and usage patterns)
  • Runtime avoidance (with associated deployment advantages)
  • Lock-in avoidance (Roo can be removed within a few minutes from any application)
  • Extensibility (via add-ons)

[edit]Batch Framework

Spring Batch is a framework for batch processing that provides reusable functions that are essential in processing large volumes of records, including:

  • logging/tracing
  • transaction management
  • job processing statistics
  • job restart
  • skip
  • resource management

It also provides more advanced technical services and features that will enable extremely high-volume and high performance batch jobs through optimizations and partitioning techniques.

[edit]Integration Framework

Spring Integration is a framework for Enterprise application integration that provides reusable functions that are essential in messaging, or event-driven architectures.

  • routers
  • transformers
  • adapters to integrate with other technologies and systems (HTTPAMQPJMSXMPPSMTPIMAPFTP (as well as FTPS/SFTP), file systems, etc.)
  • filters
  • service activators
  • management and auditing

Spring Integration supports pipe-and-filter based architectures.

[edit]References

[edit]Bibliography

[edit]See also

[edit]External links


 


Posted by linuxism
,