添加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

@@ -36,6 +36,10 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>

View File

@@ -1,29 +0,0 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8001/eureka/
registry-fetch-interval-seconds: 10
management: #开启SpringBoot Admin的监控
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always

View File

@@ -1,16 +0,0 @@
spring:
datasource:
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: reader
password: 123456
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
logging:
path: /var/logs #配置日志生成路径

View File

@@ -1,34 +1,38 @@
spring:
profiles:
active: dev #默认为开发环境
application:
name: mall-admin
server:
port: 8180
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
rabbitmq: #rabbitmq相关配置
host: localhost
port: 5672
username: guest
password: guest
mybatis:
mapper-locations:
- classpath:dao/*.xml
- classpath*:com/**/mapper/*.xml
management: #开启SpringBoot Admin的监控
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
jwt:
tokenHeader: Authorization #JWT存储的请求头
secret: mySecret #JWT加解密使用的密钥
expiration: 604800 #JWT的超期限时间(60*60*24)
tokenHead: Bearer #JWT负载中拿到开头
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/ # 上传文件夹路径前缀
logging:
level:
root: info #日志配置DEBUG,INFO,WARN,ERROR
com.macro.mall: debug
# file: demo_log.log #配置日志生成路径
# path: /var/logs #配置日志文件名称
tokenHead: Bearer #JWT负载中拿到开头

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: dev #启用环境名称
label: master #分支名称
name: admin #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: prod #启用环境名称
label: master #分支名称
name: admin #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,5 @@
spring:
profiles:
active: dev
application:
name: mall-admin

31
mall-config/.gitignore vendored Normal file
View File

@@ -0,0 +1,31 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/

38
mall-config/pom.xml Normal file
View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.macro.mall</groupId>
<artifactId>mall-config</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mall-config</name>
<description>mall-config project for mall</description>
<parent>
<groupId>com.macro.mall</groupId>
<artifactId>mall</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

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 #配置日志生成路径

View File

@@ -0,0 +1,16 @@
package com.macro.mall;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class MallConfigApplicationTests {
@Test
public void contextLoads() {
}
}

View File

@@ -35,10 +35,8 @@
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.1.6.RELEASE</version>
<scope>compile</scope>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
</dependencies>

View File

@@ -1,8 +1,6 @@
server:
port: 8082
spring:
application:
name: mall-demo
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
@@ -11,20 +9,6 @@ mybatis:
mapper-locations:
- classpath:mapper/*.xml
- classpath*:com/**/mapper/*.xml
logging:
level:
root: info #日志配置DEBUG,INFO,WARN,ERROR
com.macro.mall: debug
com.macro.mall.demo.service.FeignAdminService: debug
host:
mall:
admin: http://mall-admin
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8001/eureka/
management: #开启SpringBoot Admin的监控
endpoints:
web:
@@ -33,3 +17,6 @@ management: #开启SpringBoot Admin的监控
endpoint:
health:
show-details: always
host:
mall:
admin: http://mall-admin

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: dev #启用环境名称
label: master #分支名称
name: demo #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: prod #启用环境名称
label: master #分支名称
name: demo #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,5 @@
spring:
profiles:
active: dev
application:
name: mall-demo

View File

@@ -52,6 +52,10 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -1,32 +0,0 @@
package com.macro.mall.portal.config;
import org.apache.catalina.connector.Connector;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
/**
* tomcat相关配置
* Created by macro on 2018/8/7.
*/
@Profile("https")
@Configuration
public class TomcatConfig {
@Value("${http.port}")
private Integer port;
@Bean
public TomcatServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
tomcat.addAdditionalTomcatConnectors(createStandardConnector()); // 添加http
return tomcat;
}
//配置http
private Connector createStandardConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setPort(port);
return connector;
}
}

View File

@@ -1,59 +0,0 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
data:
mongodb:
host: localhost
port: 27017
database: mall-port
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: 123456 # Redis服务器连接密码默认为空
jedis:
pool:
max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 8 # 连接池中的最大空闲连接
min-idle: 0 # 连接池中的最小空闲连接
timeout: 3000ms # 连接超时时间(毫秒)
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
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8001/eureka/
management: #开启SpringBoot Admin的监控
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always

View File

@@ -1,52 +0,0 @@
server:
port: 8443 #https环境会开启https
ssl:
key-store: keystore.p12
key-alias: tomcat
key-store-password: 123456
key-store-type: PKCS12
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
data:
mongodb:
host: localhost
port: 27017
database: mall-port
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码默认为空
jedis:
pool:
max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 8 # 连接池中的最大空闲连接
min-idle: 0 # 连接池中的最小空闲连接
timeout: 3000ms # 连接超时时间(毫秒)
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

@@ -1,42 +0,0 @@
spring:
datasource:
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: reader
password: 123456
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
data:
mongodb:
host: mongo
port: 27017
database: mall-port
redis:
host: redis # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码默认为空
jedis:
pool:
max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 8 # 连接池中的最大空闲连接
min-idle: 0 # 连接池中的最小空闲连接
timeout: 0ms # 连接超时时间(毫秒)
rabbitmq:
host: rabbit
port: 5672
virtual-host: /mall
username: mall
password: mall
publisher-confirms: true #如果对异步消息需要回调必须设置为true
# 日志配置
logging:
path: /var/logs

View File

@@ -1,17 +1,56 @@
spring:
profiles:
active: dev #默认为开发环境
application:
name: mall-portal
server:
port: 8085
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
data:
mongodb:
host: localhost
port: 27017
database: mall-port
redis:
host: localhost # Redis服务器地址
database: 0 # Redis数据库索引默认为0
port: 6379 # Redis服务器连接端口
password: 123456 # Redis服务器连接密码默认为空
jedis:
pool:
max-active: 8 # 连接池最大连接数(使用负值表示没有限制)
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 8 # 连接池中的最大空闲连接
min-idle: 0 # 连接池中的最小空闲连接
timeout: 3000ms # 连接超时时间(毫秒)
rabbitmq:
host: localhost
port: 5672
virtual-host: /mall
username: mall
password: mall
publisher-confirms: true #如果对异步消息需要回调必须设置为true
mybatis:
mapper-locations:
- classpath:dao/*.xml
- classpath*:com/**/mapper/*.xml
http:
port: 8085 # http服务端口
# 自定义redis key
management: #开启SpringBoot Admin的监控
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always
# 自定义redis键值
redis:
key:
prefix:
@@ -19,7 +58,7 @@ redis:
orderId: "portal:orderId:"
expire:
authCode: 90 # 验证码超期时间
# 消息队列定义
# 自定义消息队列名称
rabbitmq:
queue:
name:

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: dev #启用环境名称
label: master #分支名称
name: portal #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: prod #启用环境名称
label: master #分支名称
name: portal #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,5 @@
spring:
profiles:
active: dev
application:
name: mall-portal

View File

@@ -37,6 +37,10 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
</dependencies>
<build>

View File

@@ -1,33 +0,0 @@
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
data:
elasticsearch:
repositories:
enabled: true
cluster-nodes: 127.0.0.1:9300
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8001/eureka/
management: #开启SpringBoot Admin的监控
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always

View File

@@ -1,23 +0,0 @@
spring:
datasource:
url: jdbc:mysql://db:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: reader
password: 123456
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
data:
elasticsearch:
repositories:
enabled: true
cluster-nodes: es:9300
logging:
path: /var/logs #配置日志生成路径

View File

@@ -1,21 +1,37 @@
spring:
profiles:
active: dev #默认为开发环境
application:
name: mall-search
server:
port: 8081
spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root
druid:
initial-size: 5 #连接池初始化大小
min-idle: 10 #最小空闲连接数
max-active: 20 #最大连接数
web-stat-filter:
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" #不统计这些请求数据
stat-view-servlet: #访问监控网页的登录用户名和密码
login-username: druid
login-password: druid
data:
elasticsearch:
repositories:
enabled: true
cluster-nodes: 127.0.0.1:9300
cluster-name: elasticsearch
mybatis:
mapper-locations:
- classpath:dao/*.xml
- classpath*:com/**/mapper/*.xml
logging:
level:
root: info
com.macro.mall: debug
management: #开启SpringBoot Admin的监控
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: always

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: dev #启用环境名称
label: master #分支名称
name: search #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,13 @@
spring:
cloud:
config:
profile: prod #启用环境名称
label: master #分支名称
name: search #配置文件名称
discovery:
enabled: true
service-id: mall-config
eureka:
client:
service-url:
defaultZone: http://localhost:8001/eureka/

View File

@@ -0,0 +1,5 @@
spring:
profiles:
active: dev
application:
name: mall-search

View File

@@ -19,6 +19,7 @@
<module>mall-registry</module>
<module>mall-monitor</module>
<module>mall-gateway</module>
<module>mall-config</module>
</modules>
<parent>