srping applicationContext.xml 配置

编程技术  /  houtizong 发布于 3年前   64
把两个xml文件放入src中

applicationContext.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:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsdhttp://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"default-lazy-init="true"><bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">    <property name="location">    <value>classpath:jdbc.properties</value>    <!--<value>/WEB-INF/jdbc.properties</value>--></property></bean><bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"><property name="driver" value="${db.driver}"/><property name="driverUrl" value="${db.url}"/><property name="user" value="${db.user}"/><property name="password" value="${db.password}"/>    <property name="alias" value="${db.alias}"/>    <property name="houseKeepingTestSql" value="${db.houseKeepingTestSql}"/>    <property name="maximumConnectionCount" value="${db.maximumConnectionCount}"/>    <property name="minimumConnectionCount" value="${db.minimumConnectionCount}"/></bean><bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">           <!-- 引用数据源 -->        <property name="dataSource">            <ref bean="dataSource" />        </property>                         <property name="annotatedClasses">               <list>                   <value>com.zinc.entity.ChinaCity</value>                <value>com.zinc.entity.ExchangeVolume</value>                <value>com.zinc.entity.FreindsInfo</value>                <value>com.zinc.entity.Users</value>                <value>com.zinc.entity.UserInfo</value>                <value>com.zinc.entity.ResearchOption</value>                <value>com.zinc.entity.ResearchTitle</value>                <value>com.zinc.entity.Support</value>                <value>com.zinc.entity.TopicsUsers</value>                <value>com.zinc.entity.Topics</value>                <value>com.zinc.entity.UserResearchOption</value>                <value>com.zinc.entity.Video</value>                <value>com.zinc.entity.VideoType</value>                <value>com.zinc.entity.VideoUsers</value>                <value>com.zinc.entity.DetermineVote</value>                <value>com.zinc.entity.Wordcensor</value>            <value>com.zinc.entity.Survey</value>            </list>           </property>         <property name="hibernateProperties">               <props>                   <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>                   <prop key="connection.useUnicode">true</prop>                <prop key="connection.characterEncoding">UTF-8</prop>                <prop key="hibernate.show_sql">false</prop>                   <prop key="hibernate.format_sql">false</prop>                            <prop key="hibernate.jdbc.fetch_size">20</prop>                 <prop key="hibernate.query.substitutions">true 1, false 0</prop>                 <prop key="hibernate.jdbc.batch_size">20</prop>                  <prop key="hibernate.cache.use_structured_entries">true</prop>                <prop key="hibernate.cache.use_second_level_cache">true</prop>                 <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>                <prop key="hibernate.cache.provider_configuration_file_resource_path"></prop>                                                </props>            </property>                   </bean>   <!-- 事务配置 --><bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory" /></bean><!-- 使用annotation 自动注册bean,并检查@Required,@Autowired的属性已被注入 --><context:annotation-config/> <context:component-scan base-package="com.zinc" /><!-- 使用annotation定义事务 --><tx:annotation-driven transaction-manager="txManager" /></beans>


jdbc.properties
db.driver=com.mysql.jdbc.Driverdb.url=jdbc:mysql://localhost:3306/zinc?useUnicode=true&characterEncoding=utf-8db.user=rootdb.password=rootdb.alias=MySqlPooldb.houseKeepingTestSql=select 1db.characterEncoding=utf-8db.maximumConnectionCount=30db.minimumConnectionCount=5
上一篇:常用java路径
下一篇:隔行全局换色

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

留言需要登陆哦

技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成

网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];

      订阅博客周刊 去订阅

文章归档

文章标签

友情链接

Auther ·HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群 也可以扫右边的二维码
侯体宗的博客