ifishSocket/src/test/resources/application-context.xml

113 lines
4.9 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:amq="http://activemq.apache.org/schema/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.14.1.xsd"
default-lazy-init="true">
<!-- 注册识别注解 -->
<context:component-scan base-package="com.ifish.daoImpl,com.ifish.serviceImpl"/>
<!-- 导入外部的properties文件-->
<context:property-placeholder location="classpath*:jdbc.properties" ignore-unresolvable="true"/>
<context:property-placeholder location="classpath*:mq.properties" ignore-unresolvable="true"/>
<!-- c3p0连接池 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${c3p0.driverClassName}" />
<property name="jdbcUrl" value="${c3p0.url}" />
<property name="user" value="${c3p0.username}" />
<property name="password" value="${c3p0.password}" />
<property name="autoCommitOnClose" value="${c3p0.autoCommitOnClose}" />
<property name="checkoutTimeout" value="${c3p0.checkoutTimeout}" />
<property name="initialPoolSize" value="${c3p0.initialPoolSize}" />
<property name="minPoolSize" value="${c3p0.minPoolSize}" />
<property name="maxPoolSize" value="${c3p0.maxPoolSize}" />
<property name="maxIdleTime" value="${c3p0.maxIdleTime}" />
<property name="acquireIncrement" value="${c3p0.acquireIncrement}" />
<property name="idleConnectionTestPeriod" value="${c3p0.idleConnectionTestPeriod}" />
</bean>
<!-- sessionFactory工厂 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingLocations">
<list>
<value>classpath:/com/ifish/entity/hbm/*.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.query.substitutions">${hibernate.query.substitutions}</prop>
<prop key="hibernate.jdbc.batch_size">${"hibernate.jdbc.batch_size"}</prop>
<prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>
<prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
<prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory_class}</prop>
</props>
</property>
</bean>
<!-- 开启事务注解 -->
<tx:annotation-driven transaction-manager="txManager" />
<!-- Hibernate事务管理器 -->
<bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 导入外部的properties文件-->
<context:property-placeholder location="classpath*:jPpush.properties" ignore-unresolvable="true"/>
<!-- 云信 -->
<bean id="neteaseIM" class="com.ifish.netease.NeteaseIM">
<constructor-arg index="0">
<!-- appKey -->
<value>${netease.appKey}</value>
</constructor-arg>
<constructor-arg index="1">
<!-- appSecret -->
<value>${netease.appSecret}</value>
</constructor-arg>
</bean>
<amq:connectionFactory id="amqConnectionFactory"
brokerURL="${broker_url}"
userName="${username}"
password="${password}" />
<!-- 配置JMS连接工长 -->
<bean id="connectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<constructor-arg ref="amqConnectionFactory" />
<property name="sessionCacheSize" value="100" />
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
</bean>
<!-- 定义数据存储消息队列Queue -->
<bean id="ifish7DataQueueDestination" class="org.apache.activemq.command.ActiveMQQueue">
<!-- 设置消息队列的名字 -->
<constructor-arg>
<value>${queue_data_name}</value>
</constructor-arg>
</bean>
<!-- 定义消息推送消息队列Queue -->
<bean id="ifish7PushQueueDestination" class="org.apache.activemq.command.ActiveMQQueue">
<!-- 设置消息队列的名字 -->
<constructor-arg>
<value>${queue_push_name}</value>
</constructor-arg>
</bean>
</beans>