86 lines
3.9 KiB
XML
86 lines
3.9 KiB
XML
<?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:task="http://www.springframework.org/schema/task"
|
||
xmlns:context="http://www.springframework.org/schema/context"
|
||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
|
||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
|
||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd " >
|
||
|
||
|
||
<!-- 启动注解驱动的Spring MVC功能,注册请求url和注解POJO类方法的映射 -->
|
||
<!-- <mvc:annotation-driven/> -->
|
||
|
||
<mvc:default-servlet-handler />
|
||
|
||
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
|
||
depends-on="lifecycleBeanPostProcessor" />
|
||
<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
|
||
<property name="securityManager" ref="securityManager" />
|
||
</bean>
|
||
|
||
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
|
||
<property name="exceptionMappings">
|
||
<props>
|
||
<!-- 是否授权 -->
|
||
<prop key="org.apache.shiro.authz.UnauthorizedException">
|
||
/unauthorized
|
||
</prop>
|
||
<!-- 是否认证页面 -->
|
||
<!-- <prop key="org.apache.shiro.authz.UnauthenticatedException">
|
||
/unauthenticated
|
||
</prop> -->
|
||
</props>
|
||
</property>
|
||
</bean>
|
||
|
||
<!-- 自动扫描且只扫描@Controller -->
|
||
<context:component-scan base-package="com"
|
||
use-default-filters="false">
|
||
<!-- 平台的controller,可以写多个 -->
|
||
<context:include-filter type="aspectj" expression="com.bonus..*Controller" />
|
||
</context:component-scan>
|
||
|
||
<!-- 数据库导入 -->
|
||
<bean id="excelFiledInsertDatabase" class="com.bonus.utils.ExcelFiledInsertDatabase" >
|
||
<property name = "propertyPath" value="/spring/dbconfig.properties" />
|
||
</bean>
|
||
|
||
<!-- 对静态资源文件的访问 restful -->
|
||
<mvc:resources mapping="/static/**" location="/,/static/" />
|
||
|
||
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||
<property name="viewClass"
|
||
value="org.springframework.web.servlet.view.JstlView"></property>
|
||
<property name="prefix" value="/WEB-INF/views/"></property>
|
||
<property name="suffix" value=".jsp"></property>
|
||
</bean>
|
||
|
||
<mvc:annotation-driven>
|
||
<mvc:message-converters register-defaults="true">
|
||
<!-- 避免IE执行AJAX时,返回JSON出现下载文件 -->
|
||
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
||
<property name="supportedMediaTypes">
|
||
<list>
|
||
<value>text/html;charset=UTF-8</value>
|
||
<value>text/json;charset=UTF-8</value>
|
||
<value>application/json;charset=UTF-8</value>
|
||
</list>
|
||
</property>
|
||
</bean>
|
||
</mvc:message-converters>
|
||
</mvc:annotation-driven>
|
||
<!-- 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 -->
|
||
<!-- <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||
<property name="defaultEncoding" value="utf-8" />
|
||
<property name="maxUploadSize" value="1048576000" />
|
||
<property name="maxInMemorySize" value="40960" />
|
||
</bean> -->
|
||
<!-- 打开任务注解扫描 -->
|
||
<task:annotation-driven />
|
||
<!-- 扫描任务 -->
|
||
<context:component-scan base-package="com.bonus.remind" />
|
||
</beans>
|