129 lines
5.5 KiB
XML
129 lines
5.5 KiB
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"
|
||
xmlns:task="http://www.springframework.org/schema/task"
|
||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||
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/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
|
||
http://www.springframework.org/schema/context
|
||
http://www.springframework.org/schema/context/spring-context-4.0.xsd
|
||
http://www.springframework.org/schema/task
|
||
http://www.springframework.org/schema/task/spring-task.xsd
|
||
http://www.springframework.org/schema/aop
|
||
http://www.springframework.org/schema/aop/spring-aop.xsd"
|
||
default-lazy-init="true">
|
||
|
||
<!-- 导入外部的properties文件-->
|
||
<!-- 导入外部的properties文件-->
|
||
<bean id="propertyConfigurer"
|
||
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||
<property name="locations" >
|
||
<list>
|
||
<value>classpath:mq.properties</value>
|
||
<value>classpath:jdbc.properties</value>
|
||
<value>classpath:jPpush.properties</value>
|
||
</list>
|
||
</property>
|
||
</bean>
|
||
<!-- 注册识别注解 -->
|
||
<context:component-scan base-package="com.ifish.converter,com.ifish.daoImpl,com.ifish.serviceImpl,com.ifishNew.help"/>
|
||
|
||
<!-- 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="packagesToScan">
|
||
<list>
|
||
<value>com.ifish.entity</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.query.substitutions">${hibernate.query.substitutions}</prop>
|
||
<prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</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>
|
||
|
||
<!-- async配置 -->
|
||
<task:annotation-driven executor="asyncExecutor"/>
|
||
<task:executor id="asyncExecutor" pool-size="10-100" queue-capacity="5"/>
|
||
|
||
<!-- 导入外部的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>
|
||
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" >
|
||
<property name="brokerURL" value="${broker_url}" />
|
||
<property name="userName" value="${username}" />
|
||
<property name="password" value="${password}" />
|
||
</bean>
|
||
|
||
<bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFactory"
|
||
destroy-method="stop">
|
||
<property name="connectionFactory" ref="connectionFactory"/>
|
||
<property name="maxConnections" value="100"></property>
|
||
</bean>
|
||
<!--使用缓存可以提升效率-->
|
||
<bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
|
||
<property name="targetConnectionFactory" ref="jmsFactory"/>
|
||
<property name="sessionCacheSize" value="1"/>
|
||
</bean>
|
||
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
|
||
<property name="connectionFactory" ref="cachingConnectionFactory"/>
|
||
<property name="messageConverter">
|
||
<bean class="org.springframework.jms.support.converter.SimpleMessageConverter"/>
|
||
</property>
|
||
</bean>
|
||
|
||
<!-- 定义消息推送消息队列(Queue) -->
|
||
<bean id="ifish7PushQueueDestination" class="org.apache.activemq.command.ActiveMQQueue">
|
||
<!-- 设置消息队列的名字 -->
|
||
<constructor-arg>
|
||
<value>${queue_push_name}</value>
|
||
</constructor-arg>
|
||
</bean>
|
||
|
||
</beans> |