# 工程目录

project-tree

.
+-- cafe.eureka-server     //服务注册中心模块
+-- cafe.gateway-service   //服务网关模块
+-- cafe.portal-service    //CAF通用服务模块
|   +-- src
|   |   +-- main
|   |   |   +-- java
|   |   |   +-- resources                           //maven打包模块私有资源文件夹
|   |   |   |   +-- dev                             //maven打包profile, dev环境
|   |   |   |   |   +-- application.properties      //spring配置文件
|   |   |   |   |   +-- logging-config.xml          //logback日志配置文件
|   |   |   |   |   +-- quartz.properties           //定时任务配置文件
|   |   |   |   |   +-- tx.properties               //分布式事务配置文件
|   |   |   |   +-- test                            //maven打包profile, test环境
|   |   |   |   |   +-- ...
+-- xxx-common                                      //业务通用模块, 供其他业务服务模块引用
|   +-- src
|   |   +-- main
|   |   |   +-- java
|   |   |   |   +-- ...packages
|   |   |   |   |   +-- entity                      //数据库entity映射类
|   |   |   |   |   +-- remote                      //feign client services, 微服务远程调用服务类
|   |   |   +-- resources                           //maven打包模块私有资源文件夹
+-- xxx-service                                     //业务服务模块
|   +-- src
|   |   +-- main
|   |   |   +-- java
|   |   |   |   +-- ...packages
|   |   |   |   |   +-- config                      //spring boot config包
|   |   |   |   |   +-- controller                  //controller层
|   |   |   |   |   +-- dao                         //dao层
|   |   |   |   |   |   +-- mapper                  //mybatis xml文件
|   |   |   |   |   +-- service                     //service层
|   |   |   |   |   |   +-- impl                    //service实现
|   |   |   |   |   +-- xxxApplication              //服务启动类
|   |   |   +-- resources                           //maven打包模块私有资源文件夹
|   |   |   |   +-- dev                             //maven打包profile, dev环境
|   |   |   |   |   +-- application.properties      //spring配置文件
|   |   |   |   |   +-- logging-config.xml          //logback日志配置文件
|   |   |   |   |   +-- quartz.properties           //定时任务配置文件
|   |   |   |   |   +-- tx.properties               //分布式事务配置文件
|   |   |   |   +-- test                            //maven打包profile, test环境
|   |   |   |   |   +-- ...
+-- resources                                       //maven 打包通用资源文件夹
|   +-- dev                                         //maven 打包profile, dev环境
|   |   +-- application-public.properties           //通用spring配置文件(包含数据库,redis,通用服务组件等配置)
|   |   +-- license.lic                             //授权文件
|   |   +-- publicCerts.keystore                    //授权文件
|   +-- test                                        //maven打包profile, test环境
|   |   +-- ...
+-- pom.xml                                         //maven pom文件.

# 配置文件说明

  1. resources/{env}/application-public.properties

#---------- 微服务spring cloud配置 [start] ----------#

#----- 使用service mesh时,关闭ribbon
feign.client.ribbon.enable = false
#----- 使用service mesh时,关闭服务注册
eureka.client.enabled = false

#----- 服务发现和注册中心地址 多个以,隔开, 参考spring cloud官方文档
eureka.client.serviceUrl.defaultZone=http://localhost:8761/cafe.eureka-server/eureka/
eureka.instance.lease-renewal-interval-in-seconds=5
eureka.client.registryFetchIntervalSeconds=5
ribbon.ServerListRefreshInterval=2000
server.session.timeout=1800
ribbon.ReadTimeout=120000
ribbon.ConnectTimeout=30000

#----- spring zipkin配置
#spring.zipkin.locator.discovery.enabled=true
#spring.zipkin.baseUrl=http://localhost:9500/
#spring.sleuth.sampler.percentage=1.0
#spring.sleuth.web.skipPattern=(^cleanup.*)

#---------- 微服务spring cloud配置 [end] ----------#


#----- 日志配置文件路径
logging.config=classpath:logging-config.xml


#spring session 存储方式
spring.session.store-type=redis

#---------- spring redis 连接配置 [start]  ----------#     参考spring redis 配置
spring.redis.host=localhost
spring.redis.port=6379
spring.redis.ssl=false
spring.redis.password=
spring.redis.database=1
spring.redis.pool.max-active=1000
spring.redis.pool.min-idle=10
spring.redis.pool.max-idle=10
spring.redis.pool.max-wait=5000
spring.redis.pool.timeout=10000
#---------- spring redis 连接配置  [end] ----------#



#---------- 分布式redis锁配置 [start] ----------#
locker.enable=true
locker.groups=Portal
locker.Portal.lock-group=Portal
locker.Portal.timeout=3000
locker.Portal.database=2
locker.Portal.password=
locker.Portal.address=redis://localhost:6379
locker.Portal.connectionPoolSize=100
locker.Portal.connectionMinimumIdleSize=10
#---------- 分布式redis锁配置 [end] ----------#




#---------- 数据库连接配置 [start] ----------#

#----- CAF数据库dialect: mysql / oracle / sqlserver
cafe.db.dialect=mysql

#-----数据库datasource配置, 参考spring boot datasource配置
spring.dataSource.default.url = jdbc:mysql://localhost:3306/CAF?allowMultiQueries=true&noAccessToProcedureBodies=true&characterEncoding=utf-8
spring.dataSource.default.username = root
spring.dataSource.default.password = xxx

#---------- 数据库连接配置 [end] ----------#



#---------- CAF开启werbservice服务,根路径配置
cxf.path=/openWS


#---------- No basic authentication is enabled.
security.basic.enabled=false




#---------- spring mvc配置 [start] ----------#

#-----文件上传大小配置
spring.http.multipart.maxFileSize=10MB
spring.http.multipart.maxRequestSize=10MB

#-----静态资源配置
spring.mvc.static-path-pattern=/**
spring.resources.static-locations=classpath:/static/

#---------- spring mvc配置 [end] ----------#


#---------- spring mail配置 [start] ----------#
spring.mail.port=465
spring.mail.username=
spring.mail.password=
#spring.mail.protocol=smtp
spring.mail.default-encoding=utf-8
spring.mail.host=

spring.mail.properties.mail.smtp.ssl.enable=true
spring.mail.properties.mail.imap.ssl.socketFactory.fallback=false
spring.mail.properties.mail.smtp.ssl.socketFactory.class=com.efast.cafe.framework.mail.MailSocketFactory
#---------- spring mail配置 [end] ----------#

###############################################
#      Cafe framework configuration           #
###############################################

#----------授权密钥配置
license.subject =
license.publicAlias =
license.storePass =


#是否是https站点
cafe.ssl=false

#----------web安全配置
cafe.csrf=false
cafe.system.referer=http://localhost:8080/
cafe.system.indentifier=DEFAULT_SYSTEM
cafe.system.ver=1
cafe.system.modules=PORTAL:/cafe.portal-service

#-----------业务日志记录配置
#-----是否记录业务日志到数据库
cafe.log.storage=true
#-----业务日志队列配置
cafe.log.queue.size=-1
cafe.log.queue.maxPool=20


#---------- file upload path
cafe.upload.tempDir=C:/uploadfile/
cafe.upload.dir=C:/uploadfile/
cafe.upload.maxUploadSize=31457280
cafe.upload.suffixs=xls,xlsx,jpg,gif,png,ico,bmp,jpeg,pdf,doc,docx,blob,csv
#---------- 上传文件存储方式, 1:服务器本地磁盘存储, 2:oss存储
cafe.upload.saveType=1

#---------- aliyun 短信参数
cafe.mns.accesskeyid=LTAI4SGBDyxY2oC7
cafe.mns.accesskeysecret=wAHQCQ6BG0qLW8tpDMWSSl1UHjJk5j
cafe.mns.signname=

#---------- cafe.oss.accountendpoint=oss-cn-shanghai-internal.aliyuncs.com
cafe.oss.accountendpoint=oss-cn-shanghai.aliyuncs.com
cafe.oss.idleConnectionTime=5000
cafe.oss.app.img.accountendpoint=xxxxx
cafe.oss.app.img.isPermanent=true
cafe.oss.app.img.signature=false
cafe.oss.app.bucket=efastserv
cafe.oss.app.accesskeyid=xxxxx
cafe.oss.app.accesskeysecret=xxxxx
cafe.oss.app.filepath=temp/

#---------- aliyunecs public params
cafe.aliyun.params.signatureMethod =HMAC-SHA1
cafe.aliyun.params.SignatureVersion =1.0
cafe.aliyun.params.result.format =JSON

#------feign client认证密钥
cafe.feign.secretkey=WFTkGZEsM3wJbrxStAhmZdGVSZQLhdnJyv0U4WAjzGaeOtNfuLSn3wZUB3xiZNZjI6G0c5qLLpRuwtREX0NhWns5J1SyHWCLpg5A1DV21ouryikuigqbIisB1PV3YHFycHQffwBpHNBgHL2KXhy9x74t1pO2gOHTytZ6QTKX6AbNmRwYRDx5WW3TwkHK8eVT7fzqUvHEzfkTZXA9uPemio2qZpWk5fq3ATsdqkTEsRxSOhpgonWZIwxxq8TMUpDf


#----------异步线程池参数
cafe.async.corePoolSize = 50
cafe.async.maxPoolSize = 100
cafe.async.queueCapacity = 99999
cafe.async.keepAliveSeconds = 60

#----------状态机通知-微信小程序参数
cafe.msg.weChatApplet.appid=
cafe.msg.weChatApplet.secret=
cafe.msg.weChatApplet.miniprogramState=trial

  1. xxx-service/src/main/resources/{env}/application.properties
#---------- spring boot相关配置 [start] ----------#
spring.profiles.active=public

spring.application.name=xxx-service

server.context-path=/
server.port=8080
#---------- spring boot相关配置 [end] ----------#

#----------默认连接池类型
spring.dataSource.default.type = com.alibaba.druid.pool.xa.DruidXADataSource

#---------- mybatis 配置, 参考spring mybatis相关配置
mybatis.default.config-location=classpath:mybatis-config.xml
mybatis.default.mapper-locations=classpath*:com/efast/**/mapper/*.xml
mybatis.default.mapper-scan=com.efast.**.dao


#---------- 配置服务后端实现类包配置
#-----状态机
statemach.basePackage=com.efast.wms.processor
#------通用树
tree.basePackage=com.efast.wms.processor
#------通用查询
crud.basePackage=com.efast.wms.processor

# 打包&环境说明

项目采用maven打包根据不同profile,可以打出不同环境的部署包

// 如打包dev环境,执行如下命令
$ mvn clean package -Pdev -DskipTests

# 添加一个新的打包环境(如prd)

  1. 修改/pom.xml,添加新的profile maven-add-profile
  2. 修改/pom.xml,resource配置 maven-add-profile-resource
  3. 执行打包命令
$ mvn clean package -Pprd -DskipTests