添加Spring Cloud Config配置中心支持

This commit is contained in:
macro
2019-10-23 16:40:47 +08:00
parent a4fde176f4
commit ad78ed7910
42 changed files with 502 additions and 351 deletions

View File

@@ -0,0 +1,17 @@
package com.macro.mall;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.config.server.EnableConfigServer;
@EnableConfigServer
@EnableDiscoveryClient
@SpringBootApplication
public class MallConfigApplication {
public static void main(String[] args) {
SpringApplication.run(MallConfigApplication.class, args);
}
}

View File

@@ -0,0 +1,16 @@
server:
port: 8301
spring:
application:
name: mall-config
profiles:
active: native #使用本地配置
cloud:
config:
server:
native:
search-locations: classpath:/config/{application}
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,21 @@
aliyun:
oss:
endpoint: oss-cn-shenzhen.aliyuncs.com # oss对外服务的访问域名
accessKeyId: test # 访问身份验证中用到用户标识
accessKeySecret: test # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
bucketName: macro-oss # oss的存储空间
policy:
expire: 300 # 签名有效期(S)
maxSize: 10 # 上传文件大小(M)
callback: http://39.98.190.128:8080/aliyun/oss/callback # 文件上传成功后的回调地址
dir:
prefix: mall/images/ # 上传文件夹路径前缀
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
logging:
level:
root: info #日志配置DEBUG,INFO,WARN,ERROR
com.macro.mall: debug

View File

@@ -0,0 +1,19 @@
aliyun:
oss:
endpoint: oss-cn-shenzhen.aliyuncs.com # oss对外服务的访问域名
accessKeyId: test # 访问身份验证中用到用户标识
accessKeySecret: test # 用户用于加密签名字符串和oss用来验证签名字符串的密钥
bucketName: macro-oss # oss的存储空间
policy:
expire: 300 # 签名有效期(S)
maxSize: 10 # 上传文件大小(M)
callback: http://39.98.190.128:8080/aliyun/oss/callback # 文件上传成功后的回调地址
dir:
prefix: mall/images/ # 上传文件夹路径前缀
spring:
datasource:
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: reader
password: 123456
logging:
path: /var/logs #配置日志生成路径

View File

@@ -0,0 +1,10 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
logging:
level:
root: info #日志配置DEBUG,INFO,WARN,ERROR
com.macro.mall: debug
com.macro.mall.demo.service.FeignAdminService: debug

View File

@@ -0,0 +1,7 @@
spring:
datasource:
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: reader
password: 123456
logging:
path: /var/logs #配置日志生成路径

View File

@@ -0,0 +1,28 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
data:
mongodb:
host: localhost
port: 27017
database: mall-port
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: 123456 # Redis服务器连接密码默认为空
rabbitmq:
host: localhost
port: 5672
virtual-host: /mall
username: mall
password: mall
publisher-confirms: true #如果对异步消息需要回调必须设置为true
# 日志配置
logging:
level:
org.springframework.data.mongodb.core: debug
com.macro.mall.mapper: debug
com.macro.mall.portal.dao: debug

View File

@@ -0,0 +1,29 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
data:
mongodb:
host: localhost
port: 27017
database: mall-port
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: 123456 # Redis服务器连接密码默认为空
rabbitmq:
host: localhost
port: 5672
virtual-host: /mall
username: mall
password: mall
publisher-confirms: true #如果对异步消息需要回调必须设置为true
# 日志配置
logging:
level:
org.springframework.data.mongodb.core: debug
com.macro.mall.mapper: debug
com.macro.mall.portal.dao: debug

View File

@@ -0,0 +1,13 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
data:
elasticsearch:
cluster-nodes: 127.0.0.1:9300
cluster-name: elasticsearch
logging:
level:
root: info #日志配置DEBUG,INFO,WARN,ERROR
com.macro.mall: debug

View File

@@ -0,0 +1,11 @@
spring:
datasource:
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: reader
password: 123456
data:
elasticsearch:
cluster-nodes: es:9300
cluster-name: elasticsearch
logging:
path: /var/logs #配置日志生成路径