mybatis 完结 开始 springmvc 核心配置 作用于 web层 controller后端控制器
约束头
<?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!--组件扫描 主要扫描controller--> <context:component-scan base-package="com.itheima.controller"></context:component-scan> <!--配置mvc注解驱动--> 注解 <mvc:annotation-driven></mvc:annotation-driven> aop思想 动态代理 配置访问地址的 前缀和后缀 <!--内部资源视图解析器--> <bean id="resourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/pages/"></property> <property name="suffix" value=".jsp"></property> </bean> 放行静态资源 定义servlet处理器 注解 <!--开发静态资源访问权限--> <mvc:default-servlet-handler></mvc:default-servlet-handler> </beans>