spring changes

Edit

Spring 3.0

Spring and Java EE5

Spring on J2EE 1.3

Java EE server as deployment plaform and system service provider

Spring as business component framework and infrasturucal orchestrator

upgrade: like system s/w, DB system

deloyment platform

java EE5

more than just a d3eployment platform with system service

user-lvel component model

Spring 3.1

@MVC 하위 호환성 이슈

Spring @MVC에서 3.0 → 3.1 업그레이드는 WebArgumentResolver, HandlerInterceptor 관련해서 하위 호환성 이슈가 있습니다. @MVC의 기반구조 변화는 어플리케이션 동작에 영향을 줍니다.

WebArgumentResolver와 HandlerInterceptor 모두 <mvc:annotation-driven/>을 쓸때는 주의해야합니다.

<mvc:annotation-driven/>에 의해 등록되는 MVC기반 클래스들이 아래와 같이 바뀌었기 때문인데요,

마찬기지로 <mvc:annotation-drive/> 대신 AnnotationMethodHandlerAdapter, DefaultAnnotationHandlerMapping를 수동으로 등록해도 마찬가지로 기존 클래스 동작에 변화가 없습니다.

그러나 <mvc:annotation-driven/> 선언을 쓰고 있다면 더 이상 AnnotationMethodHandlerAdapter, DefaultAnnotationHandlerMapping가 쓰이지 않습니다.

이렇게 바뀐 이유는 메서드 단위의 URL매핑에 보다 자연스러운 구조를 지원하기 위해서인데요..

토비의 Spring 3.1 VOl2의 '4.9 스프링 3.1의 @MVC (p633-669)'에 자세히 설명되어 있습니다.

WebArgumentResolver 관련

우선 WebArguemtResolver는 HandlerMethodArgumentResolver로 대처되었습니다.

같은 역할이면 HandlerMethodArgumentResolver로 새로 구현하는게 좋지만 WebArguemtResolver도 쓸 수 있도록 지원은 됩니다.

그러나 3.1에서 WebArgumentResolver를 그대로 쓰면 아래와 같은 차이점이 있습니다..

  1. WebArguementResolver에서 Exception이 발생하면 무시된다.(http://blog.naver.com/PostView.nhn?blogId=clotho95&logNo=140144711547 참조 )

  2. WebArguemtResolver가 HandlerInterceptor보다 먼저 호출된다.

만약 <mvc:annotation-driven/> + WebArguementResolver를 쓰는곳이 있다면 HandlerMethodArgumentResolver로 인터페이스를 바꿀 것을 권장합니다.

HandlerInterceptor 관련

<mvc:annotation-drive/> 을 쓸 경우 HandlerInterceptor에서 preHandle에 넘어오는 3번째 Parameter가 HandlerMethod의 형으로 넘어옵니다.

public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

}

역시나 <mvc:annotation-driven/> 과 HandlerInterceptor를 같이 쓰면서 이 3번째 Object handler 메서드 파라미터를 활용하고 있다면 주의해야 합니다.

<font face="나눔고딕, NanumGothic, 맑은 고딕, AppleGothic, 돋움">3.1에서는 </font><context:property-placeholder />으로 기본 등록되는 bean이 <font face="나눔고딕, NanumGothic, 맑은 고딕, AppleGothic, 돋움">PropertyPlaceholderConfigurer에서 PropertySourcesPlaceholderConfigurer로 바뀌었습니다.</font>

Properties파일을 직접 지정할 경우 동작은 거의 동일한데 없는 속성이 선언될경우 보다 적극적으로 에러를 내어 줍니다.</font>

<font face="나눔고딕, NanumGothic, 맑은 고딕, AppleGothic, 돋움" style="font-size: 9pt;">그리고 </font><font face="나눔고딕, NanumGothic, 맑은 고딕, AppleGothic, 돋움">Spring 3.1.0 ~ 3.1.3 버전에서는 Properties XML 선언과 관련된 버그가 있으니 유의해야 합니다.</font>

스프링소스 블로그의 관련 자료

Toby님의 Spring 3.1 분석 자료

Spring 3.2

http://static.springsource.org/spring-framework/docs/3.2.x/spring-framework-reference/html/new-in-3.2.html http://static.springsource.org/spring-framework/docs/3.2.0.RELEASE/spring-framework-reference/html/migration-3.2.html http://static.springsource.org/spring/docs/3.2.x/changelog.txt

http://static.springsource.org/spring-framework/docs/3.2.x/javadoc-api/deprecated-list.html

JDIFF : http://static.springsource.org/spring-framework/docs/3.1.3.RELEASE_to_3.2.0.RELEASE/

http://blog.springsource.org/2012/05/10/spring-mvc-3-2-preview-making-a-controller-method-asynchronous/

스프링소스 블로그의 관련 자료

RequestMappingHandlerAdapter에서 supportInternal 메소드 변화

https://github.com/SpringSource/spring-framework/commit/acc75aa4b898a34dce42748df5b54624f8b3e9f2

Spring 4.0