<?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" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans classpath:/org/springframework/beans/factory/xml/spring-beans-3.2.xsd http://www.springframework.org/schema/context classpath:/org/springframework/context/config/spring-context-3.2.xsd http://www.springframework.org/schema/aop classpath:/org/springframework/aop/config/spring-aop-3.2.xsd http://www.springframework.org/schema/tx classpath:/org/springframework/transaction/config/spring-tx-3.2.xsd http://www.springframework.org/schema/mvc classpath:/org/springframework/web/servlet/config/spring-mvc-3.2.xsd"> <mvc:annotation-driven/> <!-- 配置control的扫描路径,只扫描com.hsj.controller路径下面的@Controller --> <context:component-scan base-package="com.hsj.controller" /> <!-- 对于资源文件直接映射 --> <mvc:resources location="/static/" mapping="/static/**"/> <!-- 配置注解的适配器类,默认选项有改适配器,不配置也可以使用注解进行开发 --> <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <!-- 配置视图解析器,有标准的jsp解析器,freemark视图解析器 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property> <property name="prefix"><value>/WEB-INF/page/</value></property> <property name="suffix"><value>.jsp</value></property> </bean> </beans>
时间: 2024-11-06 01:58:18