SpringMVC配置
来源:互联网 发布:守望先锋辅助网站源码 编辑:程序博客网 时间:2024/06/06 15:44
mvc-servlet.xml
<?xml version="1.0" encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"xmlns:context="http://www.springframework.org/schema/context"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsdhttp://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd"><!-- SpringMVC上传文件时,需要配置MultipartResolver处理器 --><bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="defaultEncoding" value="UTF-8" /> <!-- 指定所上传文件的总大小,单位字节。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 10M--> <property name="maxUploadSize" value="10240000" /> </bean><!-- 扫描cn包中的所有类的注解 --><context:component-scan base-package="cn"></context:component-scan><!-- 所有文件默认由servlet控制 --><mvc:default-servlet-handler/><!-- MVC 控制层 交由Spring MVC拦截 --><mvc:annotation-driven/><!-- 从classpath类路径下加载properties配置文件 --><context:property-placeholder location="classpath:jdbc.properties"/><bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${driverClass}" /> <property name="url" value="${url}"/> <property name="username" value="${usernames}"/> <property name="password" value="${password}" /> </bean> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource" ref="dataSource"></property> </bean> <!-- 事务管理器,使用spring的事务控制 --> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <!-- 定义通知 --> <tx:advice id="myAdvise"> <tx:attributes> <tx:method name="add*"/> <tx:method name="remove*"/> <tx:method name="update*"/> <!-- 其它的方法只读,不开启事务 --> <tx:method name="*" read-only="true"/> </tx:attributes> </tx:advice> <aop:config> <aop:pointcut expression="execution(* cn.*..*.service.*.*(..))" id="myPoint"/> <aop:advisor advice-ref="myAdvise" pointcut-ref="myPoint"/> </aop:config></beans>
阅读全文
0 0
- 【SpringMVC】SpringMVC配置FastJson
- SpringMVC 配置
- SpringMVC配置
- SpringMVC 配置
- SpringMVC配置
- SpringMVC配置
- SpringMVC 配置
- springMVC 配置
- springmvc 配置
- springmvc 配置
- SpringMVC配置
- SpringMVC配置
- springMVC配置
- SpringMvc配置
- springmvc 配置
- springmvc配置
- springmvc配置
- springmvc配置
- 实习第四天
- jquery轮播
- 新浪网分类资讯爬虫
- 多线程下单例模式终极奥义
- 数据库运维类视频, 百度网盘视频下载-自学之家 mysql全套视频教程 oracle ocp国外kechengyoutube oracle ocp课程(国外youtube) oracle oc
- SpringMVC配置
- 实现与优化深度神经网络
- threading
- 如何使用sklearn进行数据挖掘
- 使用 openssl 生成证书(含openssl详解)
- CentOS安装好服务后外网不能访问
- 引用的解释
- shiro 之 封装filterChainDefinitionMap
- Spark Streaming之Kafka的Receiver和Direct方式