2011年7月9日
摘要: 在Spring3.0中在Spring3.0.5这个版本上,<mvc:annotation-driven/>声明是没有 defaultAnnotationHandlerMapping这个属性的,对于@ResultMapping标签的解析,是写死了必须用 "org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping” 这个类来处理的。在Spring 2.5中那么Spring是如何解析<mvc:annotation-driven/>标签的呢?首先,必须要有一个继承自“o 阅读全文
posted @ 2011-07-09 17:21 瓶叔 阅读(55241) 评论(0) 推荐(3) 编辑
摘要: Spring 的配置文件中,有一个配置文件头:<beans xmlns=”http://www.springframework.org/schema/beans”xsi:schemaLocation=”http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd”>这表明,在当前配置文件中,使用的是beans命名空间,可以直接使用<bean id=”">。如果要在这个配置文件中使用mvc命名空间下的annot 阅读全文
posted @ 2011-07-09 17:00 瓶叔 阅读(10707) 评论(0) 推荐(0) 编辑
摘要: 使处理请求的 Handler 能够真正的具有处理请求的能力而提供一些服务,包括为请求参数绑定应用相应的属性编辑器(通过注册 webBindingInitializer 实现)。 <beanclass="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" p:webBindingInitializer-ref="webBindingInitializer" /> 阅读全文
posted @ 2011-07-09 16:20 瓶叔 阅读(14590) 评论(0) 推荐(0) 编辑
摘要: @Autowired 注释将 @Autowired 注释标注在成员变量上import org.springframework.beans.factory.annotation.Autowired;public class Boss { @Autowired private Car car; @Autowired private Office office; …}它可以对类成员变量、方法及构造函数进行标注,完成自动装配的工作。 Spring 通过一个 BeanPostProcessor 对 @Autowired 进行解析,所以要让 @Autowired 起作用必须事先在 Spring 容器中声明 阅读全文
posted @ 2011-07-09 15:29 瓶叔 阅读(34829) 评论(1) 推荐(3) 编辑
摘要: 1、DispatcherServlet:作为前端控制器,负责分发客户的请求到 Controller 其在web.xml中的配置如下:<servlet> <servlet-name>dispatcherServlert</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</pa 阅读全文
posted @ 2011-07-09 13:50 瓶叔 阅读(3506) 评论(0) 推荐(0) 编辑