Java Spring 3.0 MVC Annotation vs COC. Whats the prefered method in the Java community?

Posted by Athens on Stack Overflow See other posts from Stack Overflow or by Athens
Published on 2010-03-16T18:19:40Z Indexed on 2010/03/16 18:21 UTC
Read the original article Hit count: 267

Filed under:

I am using Spring's MVC framework for an application I'm hosting on Google's App Engine. So far, my controllers are registered via the @Controller annotation; however, prior to getting into Spring, I evaluated ASP.net MVC 2 which requires no configuration and is based on convention. Is convention over configuration (COC) the current and preferred method in the Java community to implement MVC with Spring. Also, this may be a result of my limited knowledge so far but i noticed that i could only instantiate my Controllers the required constuctor injection if i use the COC method via the ControllerClassNameHandlerMapping. For instance the following controller bean config will fail if i use the defaultannotationhandlermapping.

My com.domain.TestController controller works fine if i use ControllerClassNameHandlerMapping/COC but it results in an error when i use defaultannotationhandlermapping/Annotations.

© Stack Overflow or respective owner

Related posts about spring-mvc