spring mvc.xml配置文件

<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:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
<!--扫描控制包-->
<context:component-scan base-package="ssm.shiro.controller"></context:component-scan>
<!--声明以注解的方式配置spring mvc-->
<mvc:annotation-driven></mvc:annotation-driven>

<!--restful风格:会默认的在web.xml中配置一个名叫default的servlet,这个servlet用来处理所有的静态资源,目前只能处理css资源,
js可以单独配置-->
<!--<mvc:default-servlet-handler></mvc:default-servlet-handler>-->

<!--配置spring mvc的内置的视图解析器-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!--配置视图的前缀-->
<property name="prefix" value="/WEB-INF/jsp/"></property>
<!--配置视图的后缀-->
<property name="suffix" value=".jsp"></property>
</bean>
<!--开启aop-->
<aop:config proxy-target-class="true"></aop:config>
<!--声明以注解的方式授权-->
<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
<property name="securityManager" ref="securityManager"></property>
</bean>
<!--配置统一的异常处理器-->
<bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<!--配置出异常后跳转的界面-->
<property name="defaultErrorView" value="error"></property>
</bean>
</beans>

猜你喜欢

转载自www.cnblogs.com/yinziqiang0909/p/11206004.html