Spring2.0 Overviewed by fantazic

Spring2.0 reference (한글 번역판 / 동국씨 수고 많으셨습니다.)
Toby님의 Spring2.0 소개

Summary – 복잡한 XML 설정이 쉬워지고 확장성이 커졌다. Annotation 활용도가 높아졌고, 새로운 기술이나 경향을 적극 도입했다.

1. Spring의 가장 주요한 기능 IoC와 AOP의 변화

  • The Inversion of Control (IoC) container
  • * Easier XML configuration – XML Schema based configuration, 태그 외에 , , 등의 태그를 AOP, 트랜잭션, 다른 프레임워크와 연동 등의 구현에 사용할 수 있다.

    <!-- creates a java.util.List instance with values loaded
    from the supplied 'sourceList' -->
    <strong><util:list id="emails"></strong>
      <value>pechorin@hero.org</value>
      <value>raskolnikov@slums.org</value>
      <value>stavrogin@gov.org</value>
      <value>porfiry@gov.org</value>
    <strong></util:list></strong>
    

    * New bean scopes – singleton, prototype 외에 session, request, 사용자 정의 scope 등이 사용될 수 있다.
    * Extensible XML authoring – 사용자 Spring 태그를 구현할 수 있다. 쉽게 확장 가능하고 plugin으로 사용 가능하다.

  • Aspect Oriented Programming (AOP)
  • * Easier AOP XML configuration – POJO 기반의 bean을 AOP에서 사용 가능하다.

    <aop:config>
      <aop:aspect id="myAspect" ref="aBean">
      ...
      </aop:aspect>
    </aop:config>
    <bean id="aBean" class="...">
      ...
    </bean>
    <aop:config>
      <aop:pointcut id="businessService"
        expression="execution(* com.xyz.myapp.service.*.*(..))"/>
    </aop:config>
    <aop:aspect id="beforeExample" ref="aBean">
      <aop:before
        pointcut-ref="dataAccessOperation"
        method="doAccessCheck"/>
      ...
    </aop:aspect>
    

    * Support for @AspectJ aspects – @AspectJ annotations 를 사용할 수 있다.

    package org.xyz;
    import org.aspectj.lang.annotation.Aspect;
    @Aspect
    public class NotVeryUsefulAspect {
      ...
    }
    

2. Middle Tier, Web Tier의 변화

  • Easier configuration of declarative transactions in XML
  • AspectJ와 연동되서 강력한 기능 발휘, @Transactional annotation 사용 가능

  • JPA
  • Java Persistence API 기능 강화

  • Asynchronous JMS
  • 비동기적 Java Message Service 기능 추가로 POJO 기반의 MessageListener 구현 가능

  • JDBC
  • NamedParameterJdbcTemplate(iBatis의 #memberId# 와 유사), SimpleJdbcTemplate(Java5.0 지원) 클래스 추가

  • A form tag library for Spring MVC
  • Spring MVC와 연동되는 모든 필요한 Taglib 추가

3. 새롭게 추가된 기능들

  • Dynamic language support
  • JRuby, Groovy and BeanShell로 작성된 bean을 사용할 수 있다.

    package org.springframework.scripting;
    public interface Messenger {
      String getMessage();
    }
    
    require  'java'
    include_class  'org.springframework.scripting.Messenger'
    class  RubyMessenger  <  Messenger
      def  setMessage(message)
        @@message  =  message
      end
      def  getMessage
        @@message
      end
    end
    

    And here is the Spring XML that defines an instance of the RubyMessenger JRuby bean.

    <lang:jruby id="messageService"
          script-interfaces="org.springframework.scripting.Messenger"
          script-source="classpath:RubyMessenger.rb">
      <lang:property name="message" value="Hello World!" />
    </lang:jruby>
    
  • JMX
  • Java Management Extensions 기능 추가

  • Task scheduling
  • Thread Pooling 구현, Quartz 구현에 사용

  • Java 5 (Tiger) support
  • Annotation 기능 활용, Spring2.0의 일부 기능은 Java5.0 이상에서만 작동 가능하다.

This entry was posted in Java and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>