<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd"
default-autowire="byName" default-lazy-init="true">
<description>define all the basic bean mappings</description>
<context:annotation-config />
<!-- jedis pool配置 -->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxActive" value="200" />
<property name="maxIdle" value="10" />
<property name="maxWait" value="1000" />
<property name="testOnBorrow" value="true" />
</bean>
<!-- jedis pool配置 -->
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg index="0" ref="jedisPoolConfig" />
<constructor-arg index="1" value="172.16.1.165"/>
<constructor-arg index="2" value="6379"/>
</bean>
<!-- 配置所有的配置信息 -->
<bean id="constants" class="com.gozap.chouti.digg.core.commons.Constants">
<property name="scoffPic" value="http://img.gozap.com/group1/M00/51/A1/wKgCIk5XCSSIAoY_AACjisrsXVs070.jpg.jpg"></property>
<property name="rumorPic" value="http://img.gozap.com/group1/M00/4F/8A/wKgCIk5V7PyMX4vTAABYVNWWTQU258.jpg.jpg"></property>
<property name="titleMaxLength" value="300"></property>
<property name="urlMaxLength" value="512"></property>
</bean>
<!-- for properties files -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:config/jdbc.properties</value>
</list>
</property>
</bean>
<!-- 数据库连接池 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://172.16.1.153:3306/chouti_digg?useUnicode=true&characterEncoding=UTF-8" />
<property name="username" value="chouti_digg" />
<property name="password" value="chouti" />
<property name="defaultAutoCommit" value="true"></property>
</bean>
<!-- Mybatis's sqlSessionFactory config -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation" value="classpath:ibatis/mybatis-config.xml"/>
</bean>
<bean name="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- 新榜榜单数据根据一定规则入热榜 -->
<bean id="choutiLinkNewToHot" class="com.gozap.chouti.digg.content.service.ChoutiLinkNewToHot">
</bean>
<!-- 配置spring定时器 -->
5000
5000
<!-- 启动spring定时器 -->
<!-- 启用事务 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- Support @Transactional tag -->
<tx:annotation-driven />
<!-- scan mappers and let them be autowired -->
<bean id="mapperConfig" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.gozap.chouti.digg.core.dao" />
</bean>
<!-- 激活annotation功能 -->
<context:annotation-config />
<!-- 激活annotation功能 -->
<context:spring-configured />