뒤늦게 관련 자료를 지하철(?)에서 틈틈히 읽고 있다. 읽다가 재밌는 내용이 있어 적어본다.
SpringOne 2008에서 SpringSource CEO인 Rod Johnson이 Keynote에서 발표한 PT의 마지막 부분을 켑쳐한 것이다.
사용자 삽입 이미지

그의 4가지 예언에 대한 내용을 나름대로(내맘대로) 풀이해 보면 이렇다.

첫번째는 Application Server(AS) 시장에 선전 포고한것과 같다. 기존 AS시장이 만만치 않고 그들과 혈투를 하겠다는것인지 상생하겠다는 것인지... 최근 SS(Springsource)가 비지니스 친화적으로 변화하고 있다는 생각이 들고, 관련 제품들이 쏫아지고 있다.

두번째는 다분히 SpringDM에 초점을 맞추고 있는듯 하다. 그만큼 OSGi에 대한 기술변화와 기대치가 큰듯하다. '아직 미래다' 라고 생각하고 있었는데 곧 '현실'이 될지 걱정이다. 공부를 안해서...

세번째는 J2EE에서 Spring의 야망을 볼수 있다. 위 첫번째 두번째 기술을 바탕으로 엔터프라이즈를 통째로 짚어 삼킬 모양이다.

네번째는 위 세가지가 성공적이라면 당연히 뒷따르는 자신감에 대함 표현일것이다. 사실 Spring한번 맛들이면 EJB 쓸일이 없긴하다.


이것을 보면서 생각되는건 기우이겠지만 앞으로 Spring을 견제할 다른 인기있는 프레임웍 등장해야 한다는 생각이다. 훌륭한 1위는 막강한 2위 존재해야만 진정성이 있기에 막강한 2위가 절실히 필요하다. (다른 DI 컨테이너형 프레임웍은 왜 지지부진할까....)

Posted by 윤성한
Spring에서 Annotation 기반의 interceptor 설정은 DefaultAnnotationHandlerMapping 으로 하면 되지만, 특별한 예외 조건을 주기엔 부족하다. 그래서 찾아 보니 관련된 자료가 있다.

아래 링크에서 여러가지 조건별 인터셉터를 할수 있게 작성된 코드가 있다.
http://code.google.com/p/springplugins/


사용 예는 아래 링크를 보자.
http://www.scottmurphy.info/spring_framework_annotation_based_controller_interceptors

Posted by 윤성한

javarebel은 전에 어디선가(?) 들어본 이름(유틸)인데 그때는 관심이 없다가 다시보니 새롭다.

개발시 톰캣을 띄워둔 상태에서 java 클래스를 변경하면 자동으로 Reload되어 짜증날때가 많다.
특히 이클립스 안에서는 재기동 할때까지 어름땡 시간이 반복된다.

Javarebel은 java파일 수정후에도 재기동 없이 .class파일을 반영해주는 유틸이다.

이것이 Spring Bean(XML or Annotation포함)을 등록(수정)시 다이나믹하게 반영될수 있다면 개발시 어름땡 시간을 줄일수 있을 것이다.

이올린에 북마크하기(0) 이올린에 추천하기(0)
Posted by 윤성한
이번 Release엔 많은 여러기능이 추가되고, Spring2.5로 이주할것을 권장하고 있다.
지금 바로 살펴봐야할 몇가지 기능도 있다.

아직(?) JDK1.4를 지원하지만, 변화된 좋은(?) 기능들을 쓰기 위해서는 JDK5.0 이나 JDK6.0으로 업그레이드해야 누릴수 있다.
현실(? 슬픈현실...)을 감안하더라도 앞으로 JDK5.0이상 버젼에 대해 준비해야 할것 같다는 생각이 든다.


[원본글] http://www.springframework.org/node/548


Spring Framework 2.5 RC1 released

Dear Spring community,

I'm pleased to announce that the first Spring Framework 2.5 release candidate is available! Spring 2.5 is the culmination of the effort that started as Spring 2.1 milestones, enhancing Spring 2.0 with many new features, such as:

  • full Java 6 and Java EE 5 support (JDBC 4.0, JTA 1.1, JavaMail 1.4, JAX-WS 2.0, etc)  
  • full-featured annotation-driven dependency injection (including support for 'qualifiers') 
  • support for component scanning in the classpath (autodetecting annotated classes) 
  • bean name pointcut element in AspectJ pointcut expressions 
  • built-in support for for AspectJ load-time weaving (based on the LoadTimeWeaver abstraction) 
  • further XML configuration namespaces ("context", "jms") for maximum convenience 
  • completely revised framework for integration tests (with support for JUnit 4 and TestNG)
  • new annotation-based controller style for Servlet MVC and Portlet MVC
  • extended SimpleJdbcTemplate functionality (support for named parameters etc) 
  • officially certified WebSphere support (support for the WebSphere 6 UOWManager facility) 
  • Spring framework jars are shipped as OSGi-compliant bundles out of the box
  • Spring ApplicationContext can be deployed as JCA RAR file (for headless application modules) 
  • JCA 1.5 message endpoint management (for Spring-managed JMS and CCI message listeners)

Spring 2.5 RC1 Released

Download | Documentation | Changelog 

Particularly worth mentioning are the annotation-based MVC controller style, the JAX-WS support and the TestNG support, all of which are introduced in this release. Furthermore, this release comes in three different distributions, introducing a minimal standard zip and an intermediate with-docs zip.

We recommend upgrading to Spring 2.5 from all previous 2.0.x versions, in order to benefit from the new features as well as from the significant performance enhancements that Spring 2.5 has to offer. Spring 2.5 is designed as a drop-in replacement for Spring 2.0, except for the slightly restructured jar file contents (see the readme file in the distribution).

Note that Spring 2.5 is still compatible with JDK 1.4.2+ and J2EE 1.3+. Java 1.4 users, for example on WebLogic 8.1 or WebSphere 5.1/6.0, are very welcome to upgrade to Spring 2.5 as well! We recommend putting the backport-util-concurrent jar on the classpath when running on Java 1.4, which allows Spring (and hence your applications) to benefit from significant concurrency enhancements.

Juergen Hoeller
Interface21
http://www.interface21.com
------------------------------------------------------------------------
Posted by 윤성한
아직 한번도 사용해보지 못한 이놈을 이번엔 꼭 적용해 보고 싶다.
이미 실행 불가능한 일정에서 어떻게든 시간을 내어 외부연동으로 사용해야 될텐데....
일단 오려두고, 자극해 보자.

Spring Web Services 1.0 Released

After two years of development, we are pleased to announce that Spring Web Services 1.0 is now available.

Spring-WS Logo

Download | Reference documentation | API documentation

Spring Web Services is a product of the Spring community focused on the creation of document-driven, contract-first web services. The key features of Spring Web Services include...

  • Making the best practice the easy practice: Spring Web Services makes enforcing best practices easier. This includes practices such as the WS-I basic profile, Contract-First development, and having a loose coupling between contract and implementation.
  • Powerful mappings: You can route an incoming XML request to any handler depending on message payload, SOAP Action header, or XPath expression.
  • XML API support: Incoming XML messages can be handled in standard JAXP APIs such as DOM, SAX, and StAX, but also JDOM, dom4j, XOM, or even marshalling technologies.
  • Flexible XML Marshalling: The Object/XML Mapping module in the Spring Web Services distribution supports JAXB 1 and 2, Castor, XMLBeans, JiBX, and XStream.  Because it is a separate module, you can use it in other environments as well.
  • Reuse of your Spring expertise: Spring-WS uses Spring application contexts for all configuration, which gets you up-and-running quickly. Also, the architecture of Spring-WS resembles that of Spring-MVC.
  • Support for WS-Security: WS-Security allows you to sign SOAP messages, encrypt and decrypt them, or authenticate against them. And it integrates with Spring Security!

Learn more about Spring Web Services at The Spring Experience, December 12 - 15, 2007 at the Westin Diplomat in Hollywood, Florida. Arjen will deliver two sessions on Spring Web Services there: Introducing Spring Web Services, and WS-DuckTyping with Web Services.

See the release notes for a list of fixes since 1.0-RC2.

Finally, a big word of thanks to all involved. It would not have been possible without you!


Posted by 윤성한

1. 고객(관객)이 평가한다.
   - 하이테크롤로지를 지향하든 어쩌든 고객의 마음에 들어야 한다.
   - UI가 중요할수 밖에 없는 이유이다.
   - 요즘은 탄탄한 구성과 시나리오가 있어야 뜬다.

2. 아키텍트(감독)에 의해서 전혀 다른 영화가 된다.
   - 우리가 영화를 고를때 거장의 이름을 믿고 보는경우가 이에 해당한다.
   - 충분한 예산과 물량만으로는 좋은영화가 만들어지기 힘들다.

3. 실제 객체처럼 완벽한 도메인모델(캐릭터)을 지향하지는 않는다.
   - 필요한 부분부터 차츰완성해 나가는 모델이며, 완전하게 만들기엔 비용이 너무 많이 든다.
   - 시나리오에 따라서 모델(캐릭터)의 일부분만 담는다.
   - 시나리오를 도메인 snap-shot 형식으로  차츰 완성해 나간다.

4. 어떤것을 만드느냐는 의도(목적)에 따라 다르다.
   - 예술영화가 될수도 있고, 상업적인 성공에 목적을 둘수도 있다.

5. 어떻게든 대부분 완료된다.
   - 다만, 완성도가 문제다. 이것은 향후 흥행과도 관계있다.

6. 스탭의 희생이 있다.
   - 우리나라에 국한될수도 있지만, 영화제작과정을 보면, 스탭들의 고충을 알수 있다.
   - SI에서도 많은 개발자들이 밤샘작업을 하기도 한다.
   - 둘다 고질적인 문제점으로 인식하고 있지만, 대안을 찾지 않을려고(찾을수있지만) 한다.
   - 두분야의 스탭들이 열정이 있다(?).
   - 훌륭한 스탭이 있으면 좋은작품을 만들 확률이 높다.

그럼 다른점은 무엇일까?
Posted by 윤성한

SimpleFormController 에서 formView 속성값을 설정하지 않으면 최종적으로 UrlBasedViewResolver에 의해서 요청 URL과 매핑 된다.

    <bean id="boardFormController" class="net.max.board.web.BoardFormController">
     <property name="boardFacade"><ref bean="boardFacade"/></property>
        <!-- property name="formView" value="board_form"/-->
        <property name="successView" value="redirect:board_list.do"/>
  <property name="validators">
   <list>
    <ref bean="beanValidator" />
   </list>
  </property>
    </bean>



즉, SimpleFormController 설정 역시 소스는 수정할 필요 없이 설정파일로 가능하다.
설정파일로만 MultiActionController, SimpleFormController 또는 일반 Controller 들을 URL 기반으로
매핑하는게 가능하다는걸 알게 되었다.

정리하면,
예제의 게시판 각 Action들은 다음과 같이 매핑된다.

[자용자 화면]

----- 요청 URL ---------      -> ------------- 매핑 뷰(JSP) -----------------
/front/board/board_list.do     -> /WEB-INF/jsp/front/board/board_list.jsp (목록)
/front/board/board_view.do   -> /WEB-INF/jsp/front/board/board_view.jsp (보기)
/front/board/board_delete.do -> /WEB-INF/jsp/front/board/board_delete.jsp (삭제)
/front/board/board_form.do    -> /WEB-INF/jsp/front/board/board_form.jsp (입력,수정)


[관리자 화면]

----- 요청 URL ---------            -> ------------- 매핑 뷰(JSP) -----------------
/manager/board/board_list.do     -> /WEB-INF/jsp/manager/board/board_list.jsp (목록)
/manager/board/board_view.do   -> /WEB-INF/jsp/manager/board/board_view.jsp (보기)
/manager/board/board_delete.do -> /WEB-INF/jsp/manager/board/board_delete.jsp (삭제)
/manager/board/board_form.do    -> /WEB-INF/jsp/manager/board/board_form.jsp (입력,수정)



[이용된 MVC Controlloer]

 - BoardController extends MultiActionController
 - BoardFormController extends SimpleFormController


[최종 설정된 XML]

<?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="
http://www.springframework.org/schema/beans"
  xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
  xmlns:p="
http://www.springframework.org/schema/p"
  xsi:schemaLocation="
http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
      <description>board action</description>

      <bean id="viewNameTranslator" class="org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator"/>
      <bean id="boardController" class="net.max.board.web.BoardController"
          p:boardFacade-ref="boardFacade"
          p:methodNameResolver-ref="boardResolver"/>

      <bean id="boardResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
        <property name="mappings">
          <props>
            <prop key="/*/*/board_list.do">list</prop>
            <prop key="/*/*/board_view.do">view</prop>
            <prop key="/*/*/board_delete.do">remove</prop>
          </props>
        </property>
      </bean>

      <bean id="boardFormController" class="net.max.board.web.BoardFormController">
        <property name="boardFacade">
          <ref bean="boardFacade"/>
        </property>
        <!-- property name="formView" value="board_form"/-->
        <property name="successView" value="redirect:board_list.do"/>
        <property name="validators">
          <list>
            <ref bean="beanValidator" />
          </list>
        </property>
      </bean>

      <bean id="handlerMapping"
          class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
          <props>
            <prop key="/*/*/board_list.do">boardController</prop>
            <prop key="/*/*/board_view.do">boardController</prop>
            <prop key="/*/*/board_delete.do">boardController</prop>
            <prop key="/*/*/board_form.do">boardFormController</prop>
          </props>
        </property>
      </bean>

      <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>

      <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
      </bean>

    </beans>


이와같이 테스트 구현1 방법으로 XML설정으로만 구현한 예를 완성했다.
설정파일의 규칙이 이미 정해져 있어서 적용이 불가능하다면, 인터셉터나, 여러 ViewResolver관련 클래스(BeanNameViewResolver, ResourceBundleViewResolver, UrlBasedViewResolver 따위)를 확장하여 구현할수도 있을거라는 생각이 든다.


Posted by 윤성한

1. 개요는 이렇다.

보통은 하나의 모듈(ex 게시판)은 사용자가 보는 화면(front)와
관리자 화면(backoffice)가 존재한다.
이것을 구현하기 위해 여러가지 방법이 있다.

첫번째로 하나의 view화면(jsp,jsf이건)에 권한을 주어 두 사용자(사용자,관리자)가
해당 view에 접근하는 방법이다.
두 관리자의 view 화면이 달라야 하므로, siteMesh나, 그 권한으로 CRUD기능을 handle 할수 있다.
Spring에서는 테마 기능이란것으로 비쥬얼한것을 처리할수도 있다.
그러나, Biz rule이 좀더 복잡해지거나, 특정기능 때문에 front view가 복잡해지고, 유지보수하면서 해당소스도 점점 지저분해지기 마련이다. 이방법의 장점은 관리하는 view(jsp)화면이 하나이므로 하나만 수정하면되나, 소스가 복잡해 지고, 해당 기능을 위해 3Tier에 좀더 많은 영향을 미친다.
여전히 선호하는 방법이긴 하다.

두번째는 front와 backoffice 뷰 파일을 따로 두는것이다. 이것은 관리파일이 두개 이므로 좀더 신경쓰이긴 하지만, 각각 분리되어 있어 서로의 뷰에 영향을 미치지 않고도 편리하게 수정할수 있다는 장점이 있다.

이 두가지 방법에서 관리자부분은 자동화하면 신속하고, 편리하게 프로젝트를 진행할수 있다.
이것을 보통 빌더 비슷하게 만들어 쓴다는건 이미 오래전부터 있어왔고, 지금도 많이 애용되는듯 하다.

2. 의도는 이렇다.

위의 첫번째 방법은 Spring에서 어렵지 않게 구현된다.
예를 들어 보자.
보통 org.springframework.web.servlet.DispatcherServlet 와 매핑된 xml에서 다음과 같이 ant 스타일 설정이 가능하며, 이는 쉽게 요청URL를 임의적으로 접근할수 있다.

    <bean id="handlerMapping"
          class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="/*/*/board_list.do">boardController</prop>
                <prop key="/*/*/board_view.do">boardController</prop>
                <prop key="/**/board_delete.do">boardController</prop>
                <prop key="/**/board_form.do">boardFormController</prop>
            </props>
        </property>
    </bean>


이것은 이미 잘 알고 있는 부분이다.
문제는 두번째 방법이다.
두번째 방법을 구현하는데에도 여러가지 방법이 있다. interceptors 속성을 이용하거나, AOP를 이용하거나, 어떤 param값을 이용하거나....
그중 가장 쉽고 편리한 방법을 찾는게 의도이다.
나는 1차적으로 설정파일로 그부분을 해결하는것이였고, 여의치 않으면 AOP를 이용하려고 시도했다.

3. 문제는 이렇다.

      예)
            1) [요청] /***어떤rul***/board/board_list.do   -->  
            2) [Controller & Model] boardListController와 매핑후 model값 return  -->
            3) [View] /***어떤rul***/board/board_list.jsp --> 브라우저



1),2)번은 어렵지않게 해결할수 있었다. 3)번은 구현하는 방법이 다양하지만, Best는 찾지 못했다.
즉, 유연한 요청 URL에 따른 요청 Controller를 매핑하고 해당 URL에 따른 뷰(JSP)를 매핑하여 보여주는것이다. 가장 쉽게 생각하는게 interceptor이다 하지만 설정파일이나, Spring에서 제공하는것으로 구현할수는 없는것일까?
아직(진행중....)까진 찾지 못했다.
나름대로 설정파일만으로도 어느정도는 해결할수 있었으나 좀더 검색을 해봐야 겠다.

4. 테스트 구현 1

action-board.xml (DispatcherServlet 과 매핑되는) 파일

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="
http://www.springframework.org/schema/beans"
  xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
  xmlns:p="
http://www.springframework.org/schema/p"
  xsi:schemaLocation="
http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

 <description>action-board</description>

    <bean id="viewNameTranslator" class="org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator"/>

    <bean id="boardController" class="net.max.board.web.BoardController"
          p:boardFacade-ref="boardFacade"
          p:methodNameResolver-ref="boardResolver"/>

 <bean id="boardResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
  <property name="mappings">
   <props>
    <prop key="/*/*/board_list.do">list</prop>
    <prop key="/*/*/board_view.do">view</prop>
    <prop key="/*/*/board_delete.do">remove</prop>

   </props>
  </property>
 </bean>

    <bean id="handlerMapping"
          class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="/*/*/board_list.do">boardController</prop>
                <prop key="/*/*/board_view.do">boardController</prop>
                <prop key="/*/*/board_delete.do">boardController</prop>
                <prop key="/*/*/board_form.do">boardFormController</prop>

            </props>
        </property>
    </bean>

    <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
</beans>


이것은 MultiActionController일때 요청 URL에 따른 각각의 뷰(JSP)파일과 잘 매칭된다.
즉, /web1/board/board_list.do 요청시 /WEB-INF/jsp/web1/board/board_list.jsp파일과 매핑된다.
좀더 구체적으로 구현 의도는 이렇다.
/front/board/board_list.do ->  /WEB-INF/jsp/front/board/board_list.jsp
/manager/board/board_list.do ->  /WEB-INF/jsp/manager/board/board_list.jsp
여기서 front와 manager 디렉토리는 hard coding 이 아닌 유연함을 유지 해야 한다.

해당 MultiActionController의 view 메서드는 아래와 같다.

 public ModelAndView view(HttpServletRequest request,HttpServletResponse response) throws Exception {
        int boardId = ServletRequestUtils.getIntParameter(request, "boardId",0);
        BoardFacadeResult boardFacadeResult = boardFacade.getBoard(new Integer(boardId));
        ModelAndView v = new ModelAndView(request.getPathTranslated());
        v.addObject("boardFacadeResult", boardFacadeResult);
        return v;
 }

SimpleFormController 일때에는 formView 속성값을 유연하게 처리해야만 한다.

다음에 계속.....

Posted by 윤성한

BLOG main image
2008년은 꿈의시작 입니다.^^* by 윤성한

카테고리

분류 전체보기 (196)
DomainDemoProject (12)
Presentation Layer (17)
Business Layer (8)
Persistence Layer (1)
책읽기 (28)
나의생각 (81)
기타 (23)
프로젝트에서 생긴일 (3)
Web Service (2)
Message Service (2)
Flex (0)
SpringDM(OSGi) (2)
생각창고 (3)
Terracotta (5)
ITSM (1)
개발환경 (1)