20080407 Monday April 07, 2008

Spring MVC's Conventions get even better Spring 2.5.3 was released this morning and contains a new feature I really like. When I first started working with Spring MVC's annotations (way back in November of last year), I found it awkward that I had to hard-code the URLs for my controllers into @RequestMappings on methods. Previous to annotations, I was using Spring's ControllerClassNameHandlerMapping which allows for more conventions-based URL-mappings.

With 2.5.3, @Controller and ControllerClassNameHandlerMapping have been synced up so you don't have to specify URLs in your annotations anymore. Thanks guys! Posted in Java at Apr 07 2008, 09:43:42 AM MDT 4 Comments

Comments:

I saw the release news form this post. Thanks. I tested 2.5.3's ControllerClassNameHandlerMapping(CCNHM) on my sample application. And I found that CCNHM just find classes that have a @Controller and extended MultiActionController(MAC). And It recornise request handling method only have HttpServletRequest and HttpServletResponse parameter.(This is MAC's requierment not @Controller's) Is this right purpose of CCNHM's change? I thought CCNHM can recornise No-Servlet API used methods. :0

Posted by whiteship on April 07, 2008 at 01:12 PM MDT #

its weird. mine doesn't work. I used the 'ControllerClassNameHandlerMapping' with the same exact 'basePackage' declared in 'context:component-scan'. But when I called the path to the controller, it couldn't find the mapping, so i ended up using the @RequestMapping last night.

Posted by dodol on April 08, 2008 at 06:49 PM MDT #

okay i found out why the ControllerClassNameHandlerMapping didn't work for me... It was like whiteship said, the ControllerClassNameHandlerMapping only found the path to MultiActionController... not to the Form-Based Controller.

Posted by dodol on April 08, 2008 at 08:06 PM MDT #

I agree, this doesn't seem to work like I expected.

Posted by Matt Raible on April 11, 2008 at 09:03 AM MDT #

Post a Comment:
  • HTML Syntax: Allowed
Click me to subscribe
Matt Raible is the Lead UI Architect at LinkedIn. The opinions on this site are mine, not my employers.
« May 2008
SunMonTueWedThuFriSat
    
2
3
4
7
8
9
12
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       
Today

Recent Entries

Tag Cloud