Spring4-Thymeleaf-MyBatis整合Context文件
来源:互联网 发布:origin如何导出数据 编辑:程序博客网 时间:2024/06/05 18:29
Context文件内容:
<?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" 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://mybatis.org/schema/mybatis-spring http://mybatis.org/schema/mybatis-spring.xsd"> <!--Controller Service等组件包--> <context:component-scan base-package="com.项目名" /> <!--springMCV 注解驱动--> <mvc:annotation-driven enable-matrix-variables="true" /> <!-- spring原配置 --> <!-- <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/WEB-INF/html位置/" /> <property name="suffix" value=".html" /> </bean> --> <!-- thymeleaf配置 --> <!-- SpringResourceTemplateResolver automatically integrates with Spring's own --> <!-- resource resolution infrastructure, which is highly recommended. --> <bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver"> <property name="prefix" value="/WEB-INF/html位置/" /> <property name="suffix" value=".html" /> <!-- 模板编码-重要!重要!! --> <property name="characterEncoding" value="utf-8" /> <!-- HTML is the default value, added here for the sake of clarity. --> <property name="templateMode" value="HTML" /> <!-- Template cache is true by default. Set to false if you want --> <!-- templates to be automatically updated when modified. --> <property name="cacheable" value="false" /> </bean> <!-- SpringTemplateEngine automatically applies SpringStandardDialect and --> <!-- enables Spring's own MessageSource message resolution mechanisms. --> <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine"> <property name="templateResolver" ref="templateResolver" /> <!-- Enabling the SpringEL compiler with Spring 4.2.4 or newer can speed up --> <!-- execution in most scenarios, but might be incompatible with specific --> <!-- cases when expressions in one template are reused across different data --> <!-- ypes, so this flag is "false" by default for safer backwards --> <!-- compatibility. --> <property name="enableSpringELCompiler" value="true" /> </bean> <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver"> <property name="templateEngine" ref="templateEngine" /> <!-- NOTE 'order' and 'viewNames' are optional <property name="order" value="1" /> <property name="viewNames" value="*.html,*.xhtml" /> --> <property name="characterEncoding" value="utf-8" /> </bean> <!-- mybatis configure --> <!-- c3p0 数据连接池 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="com.mysql.jdbc.Driver" /> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/数据库名?serverTimezone=UTC" /><!-- 时区配置 重要 --> <property name="user" value="用户名" /> <property name="password" value="密码" /> </bean> <!-- mybatis会话配置 即xml映射配置 --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="mapperLocations" value="classpath:com/xml映射位置/**/*.xml" /> <property name="dataSource" ref="dataSource" /> </bean> <!-- mybatis DAO包接口配置 --> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.DAO接口包位置.*"></property> <property name="sqlSessionFactory" ref="sqlSessionFactory"></property> </bean></beans>
阅读全文
0 0
- Spring4-Thymeleaf-MyBatis整合Context文件
- spring4与Thymeleaf整合一个简单示例
- springboot、mybatis、thymeleaf、bootstrap整合框架
- Spring4 srpingmvc Mybatis 整合源码 及过程
- Spring4.2 +Spring MVC+Mybatis 框架整合
- **Spring4.3+MyBatis 3.3.1 项目整合**
- springmvc+spring4.04+mybatis框架整合
- Spring4+Spring MVC+MyBatis整合思路
- Spring4 + Spring MVC + MyBatis 整合思路
- Spring4 + Spring MVC + MyBatis 整合思路
- Spring4 + Spring MVC + MyBatis 整合思路
- JavaEE开发之SpringBoot整合MyBatis以及Thymeleaf模板引擎
- Spring4--Spring4整合mybatis3
- spring整合mybatis文件
- MyBatis数据持久化(十)与Spring4整合
- MyBatis(8)——Mybatis3.x与Spring4.x整合
- MyBatis学习总结--Mybatis3.x与Spring4.x整合
- Spring4第五讲学习笔记,整合Spring,Struts,Mybatis框架
- HXSafeGuard工程通过VS2010编译未安装VS2008出现以下错误
- systemctl 命令完全指南
- 在 CentOS 7 下安装配置 shadowsocks
- JS日期加减
- retrofit遇上https自签名证书
- Spring4-Thymeleaf-MyBatis整合Context文件
- MyBatis报错-org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer
- cookbook(1)
- FFT 模板 大数相乘
- [LeetCode] Russian Doll Envelopes
- 端午节
- 梦20170531
- 记录昨天20170601
- 记录昨天20170602