完成pay-rpc-service配置

This commit is contained in:
shuzheng 2017-03-29 23:41:21 +08:00
parent e437035b3b
commit 70cba4f293
16 changed files with 261 additions and 6 deletions

View File

@ -11,7 +11,7 @@
<dubbo:registry address="zookeeper://127.0.0.1:2181"/> <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<dubbo:protocol name="dubbo" port="20883"/> <dubbo:protocol name="dubbo" port="20880"/>
<!-- API总系统 --> <!-- API总系统 -->
<bean id="apiService" class="com.zheng.api.rpc.service.impl.ApiServiceImpl"/> <bean id="apiService" class="com.zheng.api.rpc.service.impl.ApiServiceImpl"/>

View File

@ -11,7 +11,7 @@
<dubbo:registry address="zookeeper://127.0.0.1:2181"/> <dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<dubbo:protocol name="dubbo" port="20880"/> <dubbo:protocol name="dubbo" port="20882"/>
<!-- 文章 --> <!-- 文章 -->
<bean id="cmsArticleServiceImpl" class="com.zheng.cms.rpc.service.impl.CmsArticleServiceImpl"/> <bean id="cmsArticleServiceImpl" class="com.zheng.cms.rpc.service.impl.CmsArticleServiceImpl"/>

View File

@ -0,0 +1,20 @@
<?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:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd ">
<dubbo:application name="zheng-pay-rpc-service"/>
<dubbo:registry address="zookeeper://127.0.0.1:2181"/>
<dubbo:protocol name="dubbo" port="20883"/>
<!-- 支付方式服务 -->
<bean id="payVendorService" class="com.zheng.pay.rpc.service.impl.PayVendorServiceImpl"/>
<dubbo:service interface="com.zheng.pay.rpc.api.PayVendorService" ref="payVendorService" timeout="10000"/>
</beans>

View File

@ -0,0 +1,25 @@
<?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:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd">
<!-- 支持缓存注解 -->
<cache:annotation-driven cache-manager="cacheManager" />
<!-- 默认是cacheManager -->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
<property name="cacheManager" ref="cacheManagerFactory"/>
</bean>
<!-- cache管理器配置 -->
<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation" value="classpath:ehcache.xml"/>
<property name="shared" value="true" />
</bean>
</beans>

View File

@ -0,0 +1,114 @@
<?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:aop="http://www.springframework.org/schema/aop"
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.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<!-- 引入jdbc配置文件 -->
<!--<context:property-placeholder location="classpath:jdbc.properties" />-->
<!-- 配置进行解密 -->
<bean id="propertyConfigurer" class="com.zheng.common.plugin.EncryptPropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:redis.properties</value>
</list>
</property>
</bean>
<!-- 主库数据源 -->
<bean id="masterDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init"
destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="driverClassName" value="${master.jdbc.driver}"/>
<property name="url" value="${master.jdbc.url}"/>
<property name="username" value="${master.jdbc.username}"/>
<property name="password" value="${master.jdbc.password}"/>
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="1"/>
<property name="minIdle" value="1"/>
<property name="maxActive" value="20"/>
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="60000"/>
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000"/>
<!-- 校验语句 -->
<property name="validationQuery" value="SELECT 1"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
<!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat"/>
</bean>
<!-- 从库数据源 -->
<bean id="slaveDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
<!-- 基本属性 url、user、password -->
<property name="driverClassName" value="${slave.jdbc.driver}"/>
<property name="url" value="${slave.jdbc.url}"/>
<property name="username" value="${slave.jdbc.username}"/>
<property name="password" value="${slave.jdbc.password}"/>
<!-- 配置初始化大小、最小、最大 -->
<property name="initialSize" value="1"/>
<property name="minIdle" value="1"/>
<property name="maxActive" value="20"/>
<!-- 配置获取连接等待超时的时间 -->
<property name="maxWait" value="60000"/>
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000"/>
<!-- 校验语句 -->
<property name="validationQuery" value="SELECT 1"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
<!-- 配置监控统计拦截的filters -->
<property name="filters" value="stat"/>
</bean>
<!-- 动态数据源 -->
<bean id="dataSource" class="com.zheng.common.db.DynamicDataSource">
<property name="targetDataSources">
<map key-type="java.lang.String">
<!-- 可配置多个数据源 -->
<entry value-ref="masterDataSource" key="masterDataSource"></entry>
<entry value-ref="slaveDataSource" key="slaveDataSource"></entry>
</map>
</property>
<property name="defaultTargetDataSource" ref="masterDataSource"></property>
</bean>
<!-- 为Mybatis创建SqlSessionFactory同时指定数据源 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<property name="mapperLocations" value="classpath*:**/mapper/*Mapper.xml"/>
</bean>
<!-- Mapper接口所在包名Spring会自动查找其下的Mapper -->
<bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="**.mapper"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
<!-- 事务管理器 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 启动注解事务 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- Spring容器初始化完成监听器 -->
<bean class="com.zheng.common.listener.ApplicationContextListener"></bean>
</beans>

View File

@ -0,0 +1,2 @@
app.name=${app.name}
env=${profile.env}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
<diskStore path="java.io.tmpdir/zheng-pay-rpc-service/ehcache"/>
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
maxElementsOnDisk="10000000"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU">
<persistence strategy="localTempSwap"/>
</defaultCache>
<cache
name="zheng-pay-rpc-service-ehcache"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="300"
maxEntriesLocalHeap="10000"
maxEntriesLocalDisk="10000000"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU">
<persistence strategy="localTempSwap"/>
</cache>
</ehcache>

View File

@ -0,0 +1,9 @@
master.jdbc.driver=com.mysql.jdbc.Driver
master.jdbc.url=jdbc\:mysql\://127.0.0.1\:3306/zheng?useUnicode\=true&characterEncoding\=utf-8&autoReconnect\=true
master.jdbc.username=root
master.jdbc.password=rWd3Hb+AzNg3IXF1b5vD+g==
slave.jdbc.driver=com.mysql.jdbc.Driver
slave.jdbc.url=jdbc\:mysql\://127.0.0.1\:3306/zheng?useUnicode\=true&characterEncoding\=utf-8&autoReconnect\=true
slave.jdbc.username=root
slave.jdbc.password=rWd3Hb+AzNg3IXF1b5vD+g==

View File

@ -0,0 +1,23 @@
#off/fatal/error/warn/info/debug/all
log4j.debug=false
log4j.rootLogger=info, stdout
# Console output
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
#Spring logging configuration
log4j.category.org.springframework = warn
#Druid logging configuration
log4j.logger.druid.sql=warn,stdout
log4j.logger.druid.sql.DataSource=warn,stdout
log4j.logger.druid.sql.Connection=warn,stdout
log4j.logger.druid.sql.Statement=warn,stdout
log4j.logger.druid.sql.ResultSet=warn,stdout
# MyBatis logging configuration
log4j.logger.com.zheng.pay.dao.mapper=debug
#log4j.logger.com.zheng.pay.dao.mapper.UserMapper=debug
#log4j.logger.com.zheng.pay.dao.mapper.UserMapper.selectUser=debug

View File

@ -0,0 +1,2 @@
app.name=zheng-pay-rpc-service
profile.env=dev

View File

@ -0,0 +1,2 @@
app.name=zheng-pay-rpc-service
profile.env=pre

View File

@ -0,0 +1,2 @@
app.name=zheng-pay-rpc-service
profile.env=prod

View File

@ -0,0 +1,2 @@
app.name=zheng-pay-rpc-service
profile.env=test

View File

@ -0,0 +1,7 @@
master.redis.ip=127.0.0.1
master.redis.port=6379
master.redis.password=FNFl9F2O2Skb8yoKM0jhHA==
master.redis.max_active=500
master.redis.max_idle=5
master.redis.max_wait=10000
master.redis.timeout=10000

View File

@ -17,9 +17,13 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.zheng</groupId> <groupId>com.zheng</groupId>
<artifactId>zheng-pay-service</artifactId> <artifactId>zheng-pay-rpc-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.zheng</groupId>
<artifactId>zheng-admin</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alipay</groupId> <groupId>com.alipay</groupId>
@ -45,6 +49,12 @@
<artifactId>jstl</artifactId> <artifactId>jstl</artifactId>
<version>1.2</version> <version>1.2</version>
</dependency> </dependency>
<!-- zheng-upms-client -->
<dependency>
<groupId>com.zheng</groupId>
<artifactId>zheng-upms-client</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies> </dependencies>
<profiles> <profiles>
@ -87,11 +97,12 @@
<plugin> <plugin>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId> <artifactId>jetty-maven-plugin</artifactId>
<version>9.0.0.v20130308</version> <!--<version>9.0.0.v20130308</version>-->
<version>9.2.7.v20150116</version>
<configuration> <configuration>
<scanIntervalSeconds>3</scanIntervalSeconds> <scanIntervalSeconds>3</scanIntervalSeconds>
<webApp> <webApp>
<contextPath>/zheng-pay-web</contextPath> <contextPath>/</contextPath>
</webApp> </webApp>
<httpConnector> <httpConnector>
<port>3332</port> <port>3332</port>