<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"> <!--spring的配置文件 聲明組件掃描器--> <context:component-scan base-package="com.framework.twm.controller"/> <!--聲明視圖解析器;幫助處理視圖 主要幫助我們處理重復的多余的冗余路徑等--> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <!--前綴:指定試圖文件的路徑--> <property name="prefix" value="/WEB-INF/view/"/> <!--后綴,試圖文件的擴展名--> <property name="suffix" value=".jsp"/> <!--表示所有的jsp文件--> </bean> <!--開啟springMVC的注解支持--> <mvc:annotation-driven></mvc:annotation-driven> 它就相當于在 xml 中配置了: <!-- Begin --> <!-- HandlerMapping --> <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"></bean> <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"></bean> <!-- HandlerAdapter --> <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"></bean> <bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter"></bean> <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"></bean> <!-- HadnlerExceptionResolvers --> <bean class="org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver"></bean> <bean class="org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver"></bean> <bean class="org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver"></bean> <!-- End --> </beans>
浙公網安備 33010602011771號