Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
21e5fb95
提交
21e5fb95
authored
5月 13, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- 后端:调整 order 项目,本地开发不开启文档
- 后端:order 项目,引入 seata 分布式事务
上级
f77e5779
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
106 行增加
和
72 行删除
+106
-72
application-test.yaml
...rder-application/src/main/resources/application-test.yaml
+6
-0
application.yaml
order/order-application/src/main/resources/application.yaml
+1
-4
mybatis-config.xml
...r/order-application/src/main/resources/mybatis-config.xml
+0
-20
DatabaseConfiguration.java
.../iocoder/mall/order/biz/config/DatabaseConfiguration.java
+12
-39
SeataConfiguration.java
.../cn/iocoder/mall/order/biz/config/SeataConfiguration.java
+0
-9
application.yaml
...r-service-impl/src/main/resources/config/application.yaml
+4
-0
file.conf
order/order-service-impl/src/main/resources/file.conf
+69
-0
registry.conf
order/order-service-impl/src/main/resources/registry.conf
+14
-0
没有找到文件。
order/order-application/src/main/resources/application-test.yaml
0 → 100644
浏览文件 @
21e5fb95
swagger
:
enable
:
true
title
:
订单子系统
description
:
订单子系统
version
:
1.0.0
base-package
:
cn.iocoder.mall.pay.application.controller
order/order-application/src/main/resources/application.yaml
浏览文件 @
21e5fb95
...
@@ -9,7 +9,4 @@ server:
...
@@ -9,7 +9,4 @@ server:
context-path
:
/order-api/
context-path
:
/order-api/
swagger
:
swagger
:
title
:
订单子系统
enable
:
false
description
:
订单子系统
version
:
1.0.0
base-package
:
cn.iocoder.mall.pay.application.controller
order/order-application/src/main/resources/mybatis-config.xml
deleted
100644 → 0
浏览文件 @
f77e5779
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 使用驼峰命名法转换字段。 -->
<setting
name=
"mapUnderscoreToCamelCase"
value=
"true"
/>
</settings>
<typeAliases>
<typeAlias
alias=
"Integer"
type=
"java.lang.Integer"
/>
<typeAlias
alias=
"Long"
type=
"java.lang.Long"
/>
<typeAlias
alias=
"HashMap"
type=
"java.util.HashMap"
/>
<typeAlias
alias=
"LinkedHashMap"
type=
"java.util.LinkedHashMap"
/>
<typeAlias
alias=
"ArrayList"
type=
"java.util.ArrayList"
/>
<typeAlias
alias=
"LinkedList"
type=
"java.util.LinkedList"
/>
</typeAliases>
</configuration>
\ No newline at end of file
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/config/DatabaseConfiguration.java
浏览文件 @
21e5fb95
package
cn
.
iocoder
.
mall
.
order
.
biz
.
config
;
package
cn
.
iocoder
.
mall
.
order
.
biz
.
config
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder
;
import
io.seata.rm.datasource.DataSourceProxy
;
import
io.seata.rm.datasource.DataSourceProxy
;
import
io.seata.spring.annotation.GlobalTransactionScanner
;
import
io.seata.spring.annotation.GlobalTransactionScanner
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
...
@@ -20,56 +20,29 @@ import javax.sql.DataSource;
...
@@ -20,56 +20,29 @@ import javax.sql.DataSource;
@EnableTransactionManagement
(
proxyTargetClass
=
true
)
// 启动事务管理。为什么使用 proxyTargetClass 参数,参见 https://blog.csdn.net/huang_550/article/details/76492600
@EnableTransactionManagement
(
proxyTargetClass
=
true
)
// 启动事务管理。为什么使用 proxyTargetClass 参数,参见 https://blog.csdn.net/huang_550/article/details/76492600
public
class
DatabaseConfiguration
{
public
class
DatabaseConfiguration
{
// 数据源,使用 HikariCP
@Value
(
"${spring.application.name}"
)
@Value
(
"${spring.application.name}"
)
private
String
applicationId
;
private
String
applicationId
;
@Value
(
"${seata.tx-service-group}"
)
private
String
txServiceGroup
;
@Autowired
@Bean
(
"druidDataSource"
)
private
DataSourceProperties
dataSourceProperties
;
@ConfigurationProperties
(
"spring.datasource.druid"
)
@Bean
// @Primary
public
DruidDataSource
druidDataSource
(){
public
DruidDataSource
druidDataSource
(){
DruidDataSource
druidDataSource
=
new
DruidDataSource
();
return
DruidDataSourceBuilder
.
create
().
build
();
druidDataSource
.
setUrl
(
dataSourceProperties
.
getUrl
());
druidDataSource
.
setUsername
(
dataSourceProperties
.
getUsername
());
druidDataSource
.
setPassword
(
dataSourceProperties
.
getPassword
());
druidDataSource
.
setDriverClassName
(
dataSourceProperties
.
getDriverClassName
());
druidDataSource
.
setInitialSize
(
0
);
druidDataSource
.
setMaxActive
(
180
);
druidDataSource
.
setMaxWait
(
60000
);
druidDataSource
.
setMinIdle
(
0
);
druidDataSource
.
setValidationQuery
(
"Select 1 from DUAL"
);
druidDataSource
.
setTestOnBorrow
(
false
);
druidDataSource
.
setTestOnReturn
(
false
);
druidDataSource
.
setTestWhileIdle
(
true
);
druidDataSource
.
setTimeBetweenEvictionRunsMillis
(
60000
);
druidDataSource
.
setMinEvictableIdleTimeMillis
(
25200000
);
druidDataSource
.
setRemoveAbandoned
(
true
);
druidDataSource
.
setRemoveAbandonedTimeout
(
1800
);
druidDataSource
.
setLogAbandoned
(
true
);
return
druidDataSource
;
}
}
@ConfigurationProperties
(
prefix
=
"spring.datasource"
)
@ConfigurationProperties
(
prefix
=
"spring.datasource"
)
@Primary
@Primary
@Bean
(
"dataSource"
)
@Bean
(
"dataSource"
)
// @Bean
@DependsOn
(
"druidDataSource"
)
// 解决多数据源,循环依赖的问题。主要发生点在 DataSourceInitializerInvoker
public
DataSource
dataSource
(
DruidDataSource
dataSource
)
{
public
DataSource
dataSource
()
{
return
new
DataSourceProxy
(
dataSource
);
DruidDataSource
druidDataSource
=
druidDataSource
();
return
new
DataSourceProxy
(
druidDataSource
);
}
}
/**
* 注册一个StatViewServlet
*
* @return global transaction scanner
*/
@Bean
@Bean
public
GlobalTransactionScanner
globalTransactionScanner
()
{
public
GlobalTransactionScanner
globalTransactionScanner
()
{
return
new
GlobalTransactionScanner
(
applicationId
,
"my_test_tx_group"
);
return
new
GlobalTransactionScanner
(
applicationId
,
txServiceGroup
);
// TODO 芋艿,txServiceGroup 后续要编辑下
}
}
}
}
order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/config/SeataConfiguration.java
deleted
100644 → 0
浏览文件 @
f77e5779
package
cn
.
iocoder
.
mall
.
order
.
biz
.
config
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
SeataConfiguration
{
}
order/order-service-impl/src/main/resources/config/application.yaml
浏览文件 @
21e5fb95
...
@@ -59,3 +59,7 @@ logging:
...
@@ -59,3 +59,7 @@ logging:
level
:
level
:
# dao 开启 debug 模式 mybatis 输入 sql
# dao 开启 debug 模式 mybatis 输入 sql
cn.iocoder.mall.order.biz.dao
:
debug
cn.iocoder.mall.order.biz.dao
:
debug
# seata
seata
:
tx-service-group
:
my_test_tx_group
order/order-service-impl/src/main/resources/file.conf
0 → 100644
浏览文件 @
21e5fb95
transport
{
# tcp udt unix-domain-socket
type
=
"TCP"
#NIO NATIVE
server
=
"NIO"
#enable heartbeat
heartbeat
=
true
#thread factory for netty
thread
-
factory
{
boss
-
thread
-
prefix
=
"NettyBoss"
worker
-
thread
-
prefix
=
"NettyServerNIOWorker"
server
-
executor
-
thread
-
prefix
=
"NettyServerBizHandler"
share
-
boss
-
worker
=
false
client
-
selector
-
thread
-
prefix
=
"NettyClientSelector"
client
-
selector
-
thread
-
size
=
1
client
-
worker
-
thread
-
prefix
=
"NettyClientWorkerThread"
# netty boss thread size,will not be used for UDT
boss
-
thread
-
size
=
1
#auto default pin or 8
worker
-
thread
-
size
=
8
}
}
service
{
#vgroup->rgroup
vgroup_mapping
.
my_test_tx_group
=
"default"
#only support single node
default
.
grouplist
=
"180.167.213.26:8091"
#degrade current not support
enableDegrade
=
false
#disable
disable
=
false
}
client
{
async
.
commit
.
buffer
.
limit
=
10000
lock
{
retry
.
internal
=
10
retry
.
times
=
30
}
}
## transaction log store
store
{
## store mode: file、db
mode
=
"file"
## file store
file
{
dir
=
"file_store/data"
# branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions
max
-
branch
-
session
-
size
=
16384
# globe session size , if exceeded throws exceptions
max
-
global
-
session
-
size
=
512
# file buffer size , if exceeded allocate new buffer
file
-
write
-
buffer
-
cache
-
size
=
16384
# when recover batch read size
session
.
reload
.
read_size
=
100
}
## database store
db
{
driver_class
=
""
url
=
""
user
=
""
password
=
""
}
}
order/order-service-impl/src/main/resources/registry.conf
0 → 100644
浏览文件 @
21e5fb95
registry
{
type
=
"file"
file
{
name
=
"file.conf"
}
zk
{
cluster
=
"default"
serverAddr
=
"192.168.88.10:2181"
session
.
timeout
=
6000
connect
.
timeout
=
2000
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论