Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
extend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
park
extend
Commits
96821097
Commit
96821097
authored
Jun 19, 2020
by
lixian7
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改成Apollo配置
parent
3730afe5
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
91 deletions
+82
-91
api/pom.xml
+1
-7
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/ApiApplication.java
+7
-2
api/src/main/resources/application-dev.properties
+0
-73
api/src/main/resources/application-dev.yml
+12
-0
api/src/main/resources/application-local.yml
+12
-0
api/src/main/resources/application.properties
+0
-6
infra/pom.xml
+20
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/config/RefreshConfig.java
+27
-0
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/SmsFeign.java
+1
-1
pom.xml
+2
-2
No files found.
api/pom.xml
View file @
96821097
...
...
@@ -29,12 +29,6 @@
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
${appllo.version}
</version>
</dependency>
<dependency>
<groupId>
com.hikcreate.edl.pub.web.mobile
</groupId>
<artifactId>
domain
</artifactId>
...
...
@@ -48,7 +42,7 @@
<dependency>
<groupId>
com.hikcreate.edl.common
</groupId>
<artifactId>
sdk
</artifactId>
<version>
1.9-SNAPSHOT
</version>
<version>
${parent.version}
</version>
</dependency>
</dependencies>
...
...
api/src/main/java/com/hikcreate/edl/pub/web/mobile/api/ApiApplication.java
View file @
96821097
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
api
;
import
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
;
import
com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
@SpringBootApplication
(
scanBasePackages
=
"com.hikcreate.edl.pub.web.mobile"
)
@SpringBootApplication
(
scanBasePackages
=
"com.hikcreate.edl.pub.web.mobile"
,
exclude
=
DruidDataSourceAutoConfigure
.
class
)
@MapperScan
(
basePackages
=
"com.hikcreate.edl.pub.web.mobile.infra.data.mapper"
)
@EnableDiscoveryClient
@EnableFeignClients
@EnableFeignClients
(
"com.hikcreate"
)
@EnableEurekaClient
@EnableApolloConfig
public
class
ApiApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
api/src/main/resources/application-dev.properties
deleted
100644 → 0
View file @
3730afe5
server.port
=
60201
#数据源配置
spring.datasource.url
=
jdbc:mysql://10.197.236
\
.152:3306/edl_public?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8&useAffectedRows=true&useSSL
\
=false&zeroDateTimeBehavior=convertToNull
spring.datasource.username
=
root
spring.datasource.password
=
123456
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
# 连接池配置
# 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时
spring.datasource.druid.initial-size
=
0
# 最大连接池数量
spring.datasource.druid.max-active
=
80
spring.datasource.druid.min-idle
=
2
# 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置useUnfairLock属性为true使用非公平锁。
spring.datasource.druid.max-wait
=
8000
# 使用非公平锁。
spring.datasource.druid.use-unfair-lock
=
true
# 是否缓存preparedStatement,也就是PSCache。PSCache对支持游标的数据库性能提升巨大,比如说oracle。
# 在mysql5.5以下的版本中没有PSCache功能,建议关闭掉。5.5及以上版本有PSCache,建议开启。
spring.datasource.druid.pool-prepared-statements
=
true
# 为每个连接缓存的preparedStatement的最大数量
spring.datasource.druid.max-pool-prepared-statement-per-connection-size
=
20
# 要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为true。在Druid中,不会存在Oracle下PSCache占用内存过多的问题,可以把这个数值配置大一些,比如说100
spring.datasource.druid.max-open-prepared-statements
=
100
# 设置SQL的执行超时时间,单位:秒。当SQL超时会直接被取消掉并且抛出QLTimeoutException异常。底层调用jdbc Statement对象的void setQueryTimeout(int seconds)方法
spring.datasource.druid.validation-query-timeout
=
-1
# 用来检测连接是否有效的sql,要求是一个查询语句。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用
spring.datasource.druid.validation-query
=
SELECT NOW()
# 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-borrow
=
false
# 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。
spring.datasource.druid.test-on-return
=
false
# 申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。建议配置为true,不影响性能,并且保证安全性。
spring.datasource.druid.test-while-idle
=
true
# 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作。
spring.datasource.druid.keep-alive
=
true
# 执行查询的超时时间(秒),执行Statement对象时如果超过此时间,则抛出SQLException
spring.datasource.druid.query-timeout
=
5
# 执行一个事务的超时时间(秒),执行Statement对象时判断是否为事务,如果是且此项未设置,则使用queryTimeout
spring.datasource.druid.transaction-query-timeout
=
10
#有两个含义:
# 1) Destroy线程会检测连接的间隔时间,如果连接空闲时间大于等于minEvictableIdleTimeMillis则关闭物理连接。
# 2) testWhileIdle的判断依据,详细看testWhileIdle属性的说明
spring.datasource.druid.time-between-eviction-runs-millis
=
45000
# spring.druid.time-between-log-stats-millis = 1000
# 连接保持空闲而不被驱逐的最小时间 (30*60*1000=30分钟)
spring.datasource.druid.min-evictable-idle-time-millis
=
90000
# 每隔timeBetweenEvictionRunsMillis进行一次shrink(连接池大小收缩),shrink之后检测是否强制关闭连接时长大于removeAbandonedTimeoutMillis的连接
spring.datasource.druid.remove-abandoned
=
true
# 一个连接从被连接到被关闭之间的最大生命周期
spring.datasource.druid.remove-abandoned-timeout
=
1800
# spring.druid.filters = #配置多个英文逗号分隔
# 监控配置
spring.datasource.druid.filter.stat.log-slow-sql
=
true
spring.datasource.druid.filter.stat.slow-sql-millis
=
1000
#mybatis配置
mybatis-plus.mapperLocations
=
classpath*:**/mapper/**/*Mapper.xml
mybatis-plus.configuration.log-impl
=
org.apache.ibatis.logging.stdout.StdOutImpl
#eureka配置
eureka.client.serviceUrl.defaultZone
=
http://10.197.236.100:8761/eureka
eureka.client.healthcheck.enabled
=
true
eureka.instance.lease-renewal-interval-in-seconds
=
5
eureka.instance.lease-expiration-duration-in-seconds
=
10
eureka.instance.preferIpAddress
=
false
eureka.instance.instance-id
=
${eureka.instance.hostname}:${spring.application.name}:${server.port}
api/src/main/resources/application-dev.yml
0 → 100644
View file @
96821097
# 应用ID(在Apollo服务端新增项目添加的应用ID)
app
:
id
:
park
# apollo-configService地址
apollo
:
meta
:
http://10.197.236.187:7070
bootstrap
:
enabled
:
true
namespaces
:
Java.park-eureka,Java.park-redis,Java.park-feign,Java.park-mysql,extend
eagerLoad
:
enabled
:
true
\ No newline at end of file
api/src/main/resources/application-local.yml
0 → 100644
View file @
96821097
# 应用ID(在Apollo服务端新增项目添加的应用ID)
app
:
id
:
park
# apollo-configService地址
apollo
:
meta
:
http://10.197.236.187:7070
bootstrap
:
enabled
:
true
namespaces
:
Java.park-local-eureka,Java.park-redis,Java.park-feign,Java.park-mysql,extend
eagerLoad
:
enabled
:
true
\ No newline at end of file
api/src/main/resources/application.properties
deleted
100644 → 0
View file @
3730afe5
spring.profiles.active
=
dev
spring.application.name
=
park
infra/pom.xml
View file @
96821097
...
...
@@ -44,6 +44,26 @@
<version>
${hutoll.version}
</version>
</dependency>
<!--Apollo Start-->
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
1.6.0
</version>
</dependency>
<!--Apollo End-->
<!--多数据源支持 Start-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
<version>
2.5.4
</version>
</dependency>
<!--多数据源支持 End-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
</dependencies>
...
...
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/core/config/RefreshConfig.java
0 → 100644
View file @
96821097
package
com
.
hikcreate
.
edl
.
pub
.
web
.
mobile
.
infra
.
core
.
config
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.cloud.context.scope.refresh.RefreshScope
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/**
* @author zhaodong5
* @create 2019/10/21 17:47
*/
@Slf4j
@Component
public
class
RefreshConfig
{
@Resource
private
RefreshScope
refreshScope
;
@ApolloConfigChangeListener
(
value
=
{
"extend"
})
public
void
onChange
(
ConfigChangeEvent
changeEvent
)
{
refreshScope
.
refreshAll
();
}
}
\ No newline at end of file
infra/src/main/java/com/hikcreate/edl/pub/web/mobile/infra/data/feign/edl_pub_service_sms/SmsFeign.java
View file @
96821097
...
...
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody;
/**
* 短信feign
*/
@FeignClient
(
value
=
"
${biz.feign.service.sms}
"
,
path
=
"sms"
)
@FeignClient
(
value
=
"
edl-pub-service-sms
"
,
path
=
"sms"
)
public
interface
SmsFeign
{
@PostMapping
(
{
"send"
}
)
Result
<
Void
>
send
(
@RequestBody
SendMicReq
var1
);
...
...
pom.xml
View file @
96821097
...
...
@@ -20,11 +20,11 @@
<properties>
<java.version>
1.8
</java.version>
<spring-cloud.version>
Hoxton.SR5
</spring-cloud.version>
<appllo.version>
1.6.0
</appllo.version>
<mybatis.version>
3.3.2
</mybatis.version>
<mysql.version>
8.0.20
</mysql.version>
<mysql.version>
5.1.46
</mysql.version>
<hutoll.version>
5.3.7
</hutoll.version>
<druid.version>
1.1.22
</druid.version>
<apollo.version>
1.6.0
</apollo.version>
</properties>
<modules>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment