品优购项目--common模块配置文件
Posted hubert-dzl
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了品优购项目--common模块配置文件相关的知识,希望对你有一定的参考价值。
一、在resources包下面分别建一个properties包和spring包
1.properties包下面的配置文件:
(1)dubbox.properties
address=192.168.200.128:2181
(2)redis-config.properties
# Redis settings # server IP redis.host=192.168.200.128 # server port redis.port=6379 # server pass redis.pass= # use dbIndex redis.database=0 # 控制一个pool最多有多少个状态为idle(空闲的)的jedis实例 redis.maxIdle=300 # 表示当borrow(引入)一个jedis实例时,最大的等待时间,如果超过等待时间(毫秒),则直接抛出JedisConnectionException; redis.maxWait=3000 # 在borrow一个jedis实例时,是否提前进行validate操作;如果为true,则得到的jedis实例均是可用的 redis.testOnBorrow=true
(3)sms.properties(短信接口配置文件)
template_code=SMS_85735065 sign_name=\u9ED1\u9A6C
(4)weixinpay.properties(微信支付接口配置文件)
appid=wx8397f8696b538317 partner=1473426802 partnerkey=T6m9iK73b0kn9g5v426MKfHQH7X8rKwb notifyurl=http://a31ef7db.ngrok.io/WeChatPay/WeChatPayNotify
2.spring包下的配置文件
(1)applicationContext-dubbox.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:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="classpath*:properties/*.properties" />
<dubbo:registry protocol="zookeeper" address="$address"/>
</beans>
(2)applicationContext-redis.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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" 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/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> <!-- redis 相关配置 --> <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig"> <property name="maxIdle" value="$redis.maxIdle" /> <property name="maxWaitMillis" value="$redis.maxWait" /> <property name="testOnBorrow" value="$redis.testOnBorrow" /> </bean> <bean id="JedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" p:host-name="$redis.host" p:port="$redis.port" p:password="$redis.pass" p:pool-config-ref="poolConfig"/> <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"> <property name="connectionFactory" ref="JedisConnectionFactory" /> </bean> </beans>
以上是关于品优购项目--common模块配置文件的主要内容,如果未能解决你的问题,请参考以下文章