Commit 45b1b801 authored by xd's avatar xd

从apollo获取配置

parent de5b9241
...@@ -13,15 +13,17 @@ ...@@ -13,15 +13,17 @@
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>feo-job</name> <name>feo-job</name>
<description>Demo project for Spring Boot</description> <description>Demo project for Spring Boot</description>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
</properties> </properties>
<dependencies> <dependencies>
<!-- <dependency>--> <dependency>
<!-- <groupId>com.github.pagehelper</groupId>--> <groupId>com.ctrip.framework.apollo</groupId>
<!-- <artifactId>pagehelper</artifactId>--> <artifactId>apollo-client</artifactId>
<!-- <version>5.2.0</version>--> <version>1.8.0</version>
<!-- </dependency>--> </dependency>
<dependency> <dependency>
<groupId>com.github.binarywang</groupId> <groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-cp</artifactId> <artifactId>weixin-java-cp</artifactId>
...@@ -37,11 +39,6 @@ ...@@ -37,11 +39,6 @@
<artifactId>api-result</artifactId> <artifactId>api-result</artifactId>
<version>2.3.1</version> <version>2.3.1</version>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>p6spy</groupId>-->
<!-- <artifactId>p6spy</artifactId>-->
<!-- <version>3.9.1</version>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
...@@ -64,18 +61,17 @@ ...@@ -64,18 +61,17 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- <dependency>--> <dependency>
<!-- <groupId>com.h2database</groupId>--> <groupId>com.h2database</groupId>
<!-- <artifactId>h2</artifactId>--> <artifactId>h2</artifactId>
<!-- <scope>runtime</scope>--> <scope>test</scope>
<!-- </dependency>--> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
......
...@@ -20,7 +20,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -20,7 +20,7 @@ import lombok.extern.slf4j.Slf4j;
*/ */
@Service("JyzyOrgService") @Service("JyzyOrgService")
@Slf4j @Slf4j
@DS("z_user") @DS("jyzy_fatools")
public class JyzyOrgService { public class JyzyOrgService {
@Autowired @Autowired
......
...@@ -21,7 +21,7 @@ import java.util.List; ...@@ -21,7 +21,7 @@ import java.util.List;
*/ */
@Service("JyzyTeamService") @Service("JyzyTeamService")
@Slf4j @Slf4j
@DS("z_user") @DS("jyzy_fatools")
public class JyzyTeamService { public class JyzyTeamService {
@Autowired @Autowired
......
...@@ -19,9 +19,9 @@ import java.util.List; ...@@ -19,9 +19,9 @@ import java.util.List;
* @author zejia zj wu 2021年05月26日 * @author zejia zj wu 2021年05月26日
* @version 1.0 * @version 1.0
*/ */
@Service("JyzyUserInfoService") @Service
@Slf4j @Slf4j
@DS("z_user") @DS("jyzy_fatools")
public class JyzyUserInfoService { public class JyzyUserInfoService {
@Autowired @Autowired
......
server:
port: 8091
servlet:
context-path: /feo-jobs
spring:
datasource:
dynamic:
# primary: master #设置默认的数据源或者数据源组,默认值即为master
strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource:
master:
url: jdbc:mysql://127.0.0.1:3306/tamp_feo_user?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true
username: root # 数据库账号
password: 123456 # 数据库密码
feo_diagnose:
url: jdbc:mysql://127.0.0.1:3306/tamp_feo_diagnose_app?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username: root # 数据库账号
password: 123456 # 数据库密码
driver-class-name: com.mysql.cj.jdbc.Driver
z_user:
url: jdbc:mysql://127.0.0.1:3306/z_user?serverTimezone=Asia/Shanghai&useSSL=false&useUnicode=true&characterEncoding=UTF-8
username: root # 数据库账号
password: 123456 # 数据库密码
driver-class-name: com.mysql.cj.jdbc.Driver
hikari: # HikariCP 自定义配置,对应 HikariConfig 配置属性类
minimum-idle: 10 # 池中维护的最小空闲连接数,默认为 10 个。
maximum-pool-size: 10 # 池中最大连接数,包括闲置和使用中的连接,默认为 10 个
connection-timeout: 20000 # 客户端等待连接池连接的最大毫秒数
idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位
max-lifetime: 1200000 #池中连接关闭后的最长生命周期(以毫秒为单位)
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
resources:
static-locations: classpath:/static/,classpath:/views/
application:
name: feo-jobs
#用户
user:
wxDefaultImg: https://qimengimg.oss-cn-shanghai.aliyuncs.com/common/fatoolsHeadImg.png
#微信
wx:
#用户小程序二维码生成接口 wx12c5764ee9aeab05 为小程序appid
xcxqrcode: https://feotesttamper.tanpuyun.com/wxmini/wx/user/wx12c5764ee9aeab05/getBallCode
apollo:
meta: http://prod-feo-apollo.tamp-innner.com:8080
server:
port: 8091
servlet:
context-path: /feo-jobs
spring:
datasource:
dynamic:
# primary: master #设置默认的数据源或者数据源组,默认值即为master
strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource:
master:
url: jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_feo_user?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
username: tamp_admin
password: '@imeng123'
driver-class-name: com.mysql.cj.jdbc.Driver
feo_diagnose:
url: jdbc:mysql://rm-uf6r22t3d798q4kmkao.mysql.rds.aliyuncs.com:3306/tamp_feo_diagnose_app?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull
username: tamp_admin
password: '@imeng123'
driver-class-name: com.mysql.cj.jdbc.Driver
z_user:
url: jdbc:mysql://47.101.189.151:31931/z_user?useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&rewriteBatchedStatements=true
username: root
password: devmysql123
driver-class-name: com.mysql.cj.jdbc.Driver
hikari: # HikariCP 自定义配置,对应 HikariConfig 配置属性类
minimum-idle: 10 # 池中维护的最小空闲连接数,默认为 10 个。
maximum-pool-size: 10 # 池中最大连接数,包括闲置和使用中的连接,默认为 10 个
connection-timeout: 20000 # 客户端等待连接池连接的最大毫秒数
idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位
max-lifetime: 1200000 #池中连接关闭后的最长生命周期(以毫秒为单位)
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
resources:
static-locations: classpath:/static/,classpath:/views/
application:
name: feo-jobs
#用户
user:
wxDefaultImg: https://qimengimg.oss-cn-shanghai.aliyuncs.com/common/fatoolsHeadImg.png
#微信 apollo:
wx: meta: http://test-feo-apollo.tamp-innner.com:8080
#用户小程序二维码生成接口 wx12c5764ee9aeab05 为小程序appid
xcxqrcode: https://feotesttamper.tanpuyun.com/wxmini/wx/user/wx12c5764ee9aeab05/getBallCode
spring:
profiles: apollo:
active: local bootstrap:
\ No newline at end of file enabled: true # 启用apollo配置中心
namespaces: application.yml # 监听namespaces
cacheDir: ./apollocache/ # 配置中心缓存路径
# apollo appid
app.id: feo-jobs
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="15 seconds">
<property name="LOG_PATH" value="/data/logs"/>
<property name="LOG_FILE" value="app"/>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{500}:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- info日志记录器,日期滚动记录 -->
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%line - %msg%n</pattern>
</encoder>
<append>true</append>
<file>${LOG_PATH}/${LOG_FILE}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/${LOG_FILE}_%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>128MB</maxFileSize>
<totalSizeCap>2GB</totalSizeCap>
<!--日志文件保留天数 -->
<MaxHistory>14</MaxHistory>
</rollingPolicy>
</appender>
<!-- ERROR日志记录器,日期滚动记录 -->
<appender name="errorFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%line - %msg%n</pattern>
</encoder>
<append>true</append>
<file>${LOG_PATH}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/error_%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>128MB</maxFileSize>
<totalSizeCap>1GB</totalSizeCap>
<MaxHistory>14</MaxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<root level="info">
<appender-ref ref="console"/>
<appender-ref ref="file"/>
<appender-ref ref="errorFile"/>
</root>
</configuration>
server:
port: 8091
servlet:
context-path: /feo-jobs
spring:
application:
name: feo-jobs
datasource:
dynamic:
primary: master # 设置默认的数据源或者数据源组
strict: false # 严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource:
master:
url: jdbc:h2:mem:test
username: root
password: test
driver-class-name: org.h2.Driver
schema: classpath:db/schema-h2.sql
data: classpath:db/data-h2.sql
# Logger Config
logging:
level:
com.tanpu.feo.feojob: debug
user:
wxDefaultImg:
wx:
xcxqrcode:
DELETE
FROM demo;
INSERT INTO demo (name, age)
VALUES ('Jone', 18),
('Jack', 18),
('Jack', 18),
('Jack', 18),
('Ted', 18),
('Billie', 22);
-- noinspection SqlNoDataSourceInspectionForFile
DROP TABLE IF EXISTS demo;
CREATE TABLE demo
(
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '名称',
`age` int(11) NOT NULL DEFAULT 0 COMMENT '年龄',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (id)
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment