springmvc 始终无法加载 注解 map, 解决办法
八月 11, 2015 8:24:42 下午 org.springframework.web.servlet.DispatcherServlet initServletBean 信息: FrameworkServlet ‘mvc-dispatcher‘: initialization started 八月 11, 2015 8:24:42 下午 org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh 信息: Refreshing WebApplicationContext for namespace ‘mvc-dispatcher-servlet‘: startup date [Tue Aug 11 20:24:42 CST 2015]; parent: Root WebApplicationContext 八月 11, 2015 8:24:42 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息: Loading XML bean definitions from ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml] 八月 11, 2015 8:24:43 下午 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler 信息: Mapped URL path [/**] onto handler ‘org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0‘ 八月 11, 2015 8:24:43 下午 org.springframework.web.servlet.DispatcherServlet initServletBean 信息: FrameworkServlet ‘mvc-dispatcher‘: initialization completed in 702 ms
在mvc-dispatcher-servlet.xml 添加<mvc:annotation-driven />
八月 11, 2015 8:22:17 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod 信息: Mapped "{[//hello],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.springapp.mvc.HelloController.printWelcome(org.springframework.ui.ModelMap) 八月 11, 2015 8:22:18 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache 信息: Looking for @ControllerAdvice: WebApplicationContext for namespace ‘mvc-dispatcher-servlet‘: startup date [Tue Aug 11 20:22:17 CST 2015]; parent: Root WebApplicationContext 八月 11, 2015 8:22:18 下午 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache 信息: Looking for @ControllerAdvice: WebApplicationContext for namespace ‘mvc-dispatcher-servlet‘: startup date [Tue Aug 11 20:22:17 CST 2015]; parent: Root WebApplicationContext 八月 11, 2015 8:22:18 下午 org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler 信息: Mapped URL path [/**] onto handler ‘org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0‘ 八月 11, 2015 8:22:18 下午 org.springframework.web.servlet.DispatcherServlet initServletBean 信息: FrameworkServlet ‘mvc-dispatcher‘: initialization completed in 1131 ms
关于
mvc-dispatcher-servlet.xml 名字的部分是在web.xml中配置的
<servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class></servlet><servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/</url-pattern></servlet-mapping>
时间: 2024-10-10 05:17:03