品优购项目--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>

  

原文地址:https://www.cnblogs.com/Hubert-dzl/p/11503520.html

时间: 2024-07-29 19:49:11

品优购项目--common模块配置文件的相关文章

品优购项目--dao模块配置文件

一.在resources包下,分别建三个包:mybatis.properties.spring包 1.mybatis包下的配置文件 (1)SqlMapConfig.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.o

品优购项目--service-sellergoods模块的配置文件

一.web.xml文件 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/n

品优购项目

项目技能: 1.使用AngularJS前端框架完成前后端交互 2.完成品牌的基本管理功能的开发 AngularJS四大特性: 1.MVC 2.双向绑定 3.依赖注入 4.模块化设计 指令:显示变量的值得表达式: {{ }} ng-app 在angularJS的作用范围 ng-model: 绑定变量 ng-init: 初始化 ng-click: 点击事件 ng-repeat:循环 { }: 对象 [ ]: 集合 控制器: 控制器页面元素-->对页面的数据进行操作,也就是说,所有的页面上的js操作都

品优购项目依赖文件的引入

<!--版本号--> <properties> <junit.version>4.12</junit.version> <spring.version>4.2.4.RELEASE</spring.version> <pagehelper.version>4.0.0</pagehelper.version> <servlet-api.version>2.5</servlet-api.versio

品优购商城项目(二)mybatis分页插件

品优购商城项目第二天,使用mybatis分页插件实现分页. 一.引用mybatis分页插件 SqlMapConfig.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config

品优购商城项目(三)安全框架SpringSecurity

品优购商城项目第三阶段 1.springSecurity的基本用法与shiro类似. 2.BCrypt加密算法比MD5更加智能和安全,能自动加盐再加密,生成的密码是60位比md5的32位更占空间(可以忽略不计),由于密码长度增加安全系数更高,且盐不是明文由算法自动生成和解析,用户不需要关心. 3.set的使用,在下面这个引用类中用注解@[email protected]报错,后在类中用set方法成功 <!-- 认证类 --> <beans:bean id="userDetail

002 --品优购的系统架构

品优购采用的是SOA系统架构,为什么会采用这种架构风格?当然有他自己的好处! 1.1SOA的概念? 面向服务的架构(SOA)是一个组件模型,它将应用程序的不同功能单元(称为服务)通过这些服务之间定义良好的接口和契约联系起来.接口是采用中立的方式进行定义的,它应该独立于实现服务的硬件平台.操作系统和编程语言.这使得构建在各种各样的系统中的服务可以以一种统一和通用的方式进行交互.    SOA系统架构得优点: 1:简单系统的开发:由于SOA具有组合性,可以利用现有的SOA资源,根据同样的开放标准,不

【project】品优购——01

需求分析与系统设计 品优购网上商城主要分为网站前台.运营商后台.商家管理后台三个子系统. 简介 网站前台:主要包括网站首页.商家首页.商品详细页..搜索页.会员中心.订单与支付相关页面.秒杀频道等 运营商后台:是运营商的运营人员的管理后台. 主要包括商家审核.品牌管理.规格管理.模板管理.商品分类管理.商品审核.广告类型管理.广告管理.订单查询.商家结算等 商家管理后台:入驻的商家进行管理的后台,主要功能是对商品的管理以及订单查询统计.资金结算等功能 系统架构 该项目采用SOA架构,即面向服务的

大型分布式电商项目---品优购

概述 这是一个综合性的B2B2C平台,类似京东商城.天猫商城.网站采用商家入驻的模式.该项目采用Spring+SpirngMVC+Mybatis框架搭建的maven工程,并采用分布式架构按功能将系统分为不同的子系统,将不同的子系统部署到不同的节点服务器独立运行.在各个系统之间采用dubbox+zookeeper进行通信,实现了基于SOA面向服务的架构,使得服务层与表现层分离,此项目为本人学习项目,为传智播客,最后一个商城实战项目,前前后后花了2个月左右,后面几天的内容暂时没做,因为电脑吃不消,完