Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringCloudAlibaba
提交
0416de1a
S
SpringCloudAlibaba
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringCloudAlibaba
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringCloudAlibaba
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0416de1a
编写于
2月 19, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:添加seata的AT模式
上级
c641f54f
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
319 addition
and
40 deletion
+319
-40
nacos-server-common/pom.xml
nacos-server-common/pom.xml
+5
-1
nacos-server-common/src/main/java/com/kwan/springcloudalibaba/entity/User.java
...rc/main/java/com/kwan/springcloudalibaba/entity/User.java
+1
-4
nacos-server-consumer/pom.xml
nacos-server-consumer/pom.xml
+33
-0
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/controller/ConsumerUserController.java
...springcloudalibaba/controller/ConsumerUserController.java
+2
-2
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/controller/SeataControlller.java
.../kwan/springcloudalibaba/controller/SeataControlller.java
+28
-0
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/entity/Person.java
.../main/java/com/kwan/springcloudalibaba/entity/Person.java
+13
-0
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/mapper/PersonMapper.java
...java/com/kwan/springcloudalibaba/mapper/PersonMapper.java
+12
-0
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/service/IPersonService.java
...a/com/kwan/springcloudalibaba/service/IPersonService.java
+10
-0
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/service/impl/PersonServiceImpl.java
...an/springcloudalibaba/service/impl/PersonServiceImpl.java
+32
-0
nacos-server-consumer/src/main/resources/bootstrap.yml
nacos-server-consumer/src/main/resources/bootstrap.yml
+25
-1
nacos-server-feign-api/src/main/java/com/kwan/springcloudalibaba/api/FeignUserService.java
...ava/com/kwan/springcloudalibaba/api/FeignUserService.java
+4
-0
nacos-server-gateway/pom.xml
nacos-server-gateway/pom.xml
+12
-0
nacos-server-gateway/src/main/java/com/kwan/springcloudalibaba/config/GatewayConfig.java
...ava/com/kwan/springcloudalibaba/config/GatewayConfig.java
+33
-0
nacos-server-gateway/src/main/java/com/kwan/springcloudalibaba/util/GetZonedDateTime.java
...va/com/kwan/springcloudalibaba/util/GetZonedDateTime.java
+11
-0
nacos-server-gateway/src/main/resources/bootstrap.yml
nacos-server-gateway/src/main/resources/bootstrap.yml
+23
-1
nacos-server-producer-9091/pom.xml
nacos-server-producer-9091/pom.xml
+4
-0
nacos-server-producer-9091/src/main/java/com/kwan/springcloudalibaba/controller/UserController.java
...om/kwan/springcloudalibaba/controller/UserController.java
+7
-1
nacos-server-producer-9091/src/main/java/com/kwan/springcloudalibaba/service/IUserService.java
...ava/com/kwan/springcloudalibaba/service/IUserService.java
+8
-0
nacos-server-producer-9091/src/main/java/com/kwan/springcloudalibaba/service/impl/UserServiceImpl.java
...kwan/springcloudalibaba/service/impl/UserServiceImpl.java
+7
-0
nacos-server-producer-9091/src/main/resources/bootstrap.yml
nacos-server-producer-9091/src/main/resources/bootstrap.yml
+11
-2
nacos-server-producer-9092/pom.xml
nacos-server-producer-9092/pom.xml
+4
-0
nacos-server-producer-9092/src/main/java/com/kwan/springcloudalibaba/controller/UserController.java
...om/kwan/springcloudalibaba/controller/UserController.java
+6
-2
nacos-server-producer-9092/src/main/java/com/kwan/springcloudalibaba/entity/User.java
...rc/main/java/com/kwan/springcloudalibaba/entity/User.java
+0
-24
nacos-server-producer-9092/src/main/java/com/kwan/springcloudalibaba/service/IUserService.java
...ava/com/kwan/springcloudalibaba/service/IUserService.java
+9
-0
nacos-server-producer-9092/src/main/java/com/kwan/springcloudalibaba/service/impl/UserServiceImpl.java
...kwan/springcloudalibaba/service/impl/UserServiceImpl.java
+8
-0
nacos-server-producer-9092/src/main/resources/bootstrap.yml
nacos-server-producer-9092/src/main/resources/bootstrap.yml
+11
-2
未找到文件。
nacos-server-common/pom.xml
浏览文件 @
0416de1a
...
...
@@ -65,7 +65,11 @@
<artifactId>
fastjson
</artifactId>
<version>
2.0.21
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
3.4.3
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
nacos-server-
producer-9091
/src/main/java/com/kwan/springcloudalibaba/entity/User.java
→
nacos-server-
common
/src/main/java/com/kwan/springcloudalibaba/entity/User.java
浏览文件 @
0416de1a
...
...
@@ -14,11 +14,8 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@NoArgsConstructor
public
class
User
{
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
String
name
;
private
String
sex
;
}
}
\ No newline at end of file
nacos-server-consumer/pom.xml
浏览文件 @
0416de1a
...
...
@@ -54,5 +54,38 @@
<artifactId>
spring-cloud-starter-netflix-ribbon
</artifactId>
<version>
2.0.0.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-seata
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
3.4.3
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid
</artifactId>
<version>
1.2.3
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
<version>
3.9
</version>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.11
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
1.1.10
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/controller/ConsumerUserController.java
浏览文件 @
0416de1a
...
...
@@ -134,7 +134,7 @@ public class ConsumerUserController {
*/
@GetMapping
(
value
=
"/test"
,
produces
=
MediaType
.
APPLICATION_PROBLEM_JSON_VALUE
)
public
Result
test
()
{
return
Result
.
ok
();
return
Result
.
ok
(
"test"
);
}
...
...
@@ -143,6 +143,6 @@ public class ConsumerUserController {
*/
@GetMapping
(
value
=
"/index"
,
produces
=
MediaType
.
APPLICATION_PROBLEM_JSON_VALUE
)
public
Result
index
()
{
return
Result
.
ok
();
return
Result
.
ok
(
"index"
);
}
}
\ No newline at end of file
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/controller/SeataControlller.java
0 → 100644
浏览文件 @
0416de1a
package
com.kwan.springcloudalibaba.controller
;
import
com.kwan.springcloudalibaba.entity.Person
;
import
com.kwan.springcloudalibaba.service.IPersonService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
@Slf4j
@RestController
@RequestMapping
(
"/seata"
)
public
class
SeataControlller
{
@Autowired
private
IPersonService
personService
;
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
GET
)
public
Person
save
()
{
//保存用户
Person
person
=
new
Person
();
person
.
setAddress
(
"深圳"
);
person
.
setUsername
(
"秦梓淞111"
);
person
.
setGender
(
"男"
);
return
personService
.
savePerson
(
person
);
}
}
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/entity/Person.java
0 → 100644
浏览文件 @
0416de1a
package
com.kwan.springcloudalibaba.entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
@Data
@TableName
(
value
=
"person"
)
public
class
Person
{
private
Integer
id
;
private
String
username
;
private
String
address
;
private
String
gender
;
}
\ No newline at end of file
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/mapper/PersonMapper.java
0 → 100644
浏览文件 @
0416de1a
package
com.kwan.springcloudalibaba.mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.kwan.springcloudalibaba.entity.Person
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
PersonMapper
extends
BaseMapper
<
Person
>
{
}
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/service/IPersonService.java
0 → 100644
浏览文件 @
0416de1a
package
com.kwan.springcloudalibaba.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.kwan.springcloudalibaba.entity.Person
;
public
interface
IPersonService
extends
IService
<
Person
>
{
Person
savePerson
(
Person
person
);
}
nacos-server-consumer/src/main/java/com/kwan/springcloudalibaba/service/impl/PersonServiceImpl.java
0 → 100644
浏览文件 @
0416de1a
package
com.kwan.springcloudalibaba.service.impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.kwan.springcloudalibaba.api.FeignUserService
;
import
com.kwan.springcloudalibaba.entity.Person
;
import
com.kwan.springcloudalibaba.entity.User
;
import
com.kwan.springcloudalibaba.mapper.PersonMapper
;
import
com.kwan.springcloudalibaba.service.IPersonService
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
PersonServiceImpl
extends
ServiceImpl
<
PersonMapper
,
Person
>
implements
IPersonService
{
@Autowired
private
PersonMapper
personMapper
;
@Autowired
private
FeignUserService
feignUserService
;
@Override
@GlobalTransactional
public
Person
savePerson
(
Person
person
)
{
personMapper
.
insert
(
person
);
User
user
=
new
User
();
user
.
setName
(
person
.
getUsername
());
user
.
setSex
(
person
.
getGender
());
feignUserService
.
save
(
user
);
return
person
;
}
}
nacos-server-consumer/src/main/resources/bootstrap.yml
浏览文件 @
0416de1a
...
...
@@ -17,4 +17,28 @@ spring:
file-extension
:
yaml
#文件类型
group
:
DEV_GROUP
#组别
namespace
:
4cd9bd32-8f25-45cd-b919-df1a0df146e0
#命名空间
refresh-enabled
:
true
#默认自动刷新
\ No newline at end of file
refresh-enabled
:
true
#默认自动刷新
seata
:
application-id
:
nacos-server-consumer
tx-service-group
:
my-tx-group
service
:
vgroup-mapping
:
my-tx-group
:
seata-server
grouplist
:
seata-server
:
127.0.0.1:8091
enabled
:
true
ribbon
:
#建立连接超时时间
ConnectTimeout
:
5000
#建立连接之后,读取响应资源超时时间
ReadTimeout
:
5000
feign
:
client
:
config
:
#这里填具体的服务名称(也可以填default,表示对所有服务生效)
default
:
#connectTimeout和readTimeout这两个得一起配置才会生效
connectTimeout
:
5000
readTimeout
:
5000
\ No newline at end of file
nacos-server-feign-api/src/main/java/com/kwan/springcloudalibaba/api/FeignUserService.java
浏览文件 @
0416de1a
package
com.kwan.springcloudalibaba.api
;
import
com.kwan.springcloudalibaba.common.Result
;
import
com.kwan.springcloudalibaba.entity.User
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
...
...
@@ -20,4 +22,6 @@ public interface FeignUserService {
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/{id}"
,
produces
=
MediaType
.
APPLICATION_PROBLEM_JSON_VALUE
)
Result
selectOne
(
@PathVariable
(
value
=
"id"
)
Integer
id
);
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/save"
,
produces
=
MediaType
.
APPLICATION_PROBLEM_JSON_VALUE
)
Result
save
(
@RequestBody
User
user
);
}
nacos-server-gateway/pom.xml
浏览文件 @
0416de1a
...
...
@@ -2,6 +2,18 @@
<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>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
8
</source>
<target>
8
</target>
</configuration>
</plugin>
</plugins>
</build>
<parent>
<groupId>
com.kwan.springcloudalibaba
</groupId>
...
...
nacos-server-gateway/src/main/java/com/kwan/springcloudalibaba/config/GatewayConfig.java
0 → 100644
浏览文件 @
0416de1a
package
com.kwan.springcloudalibaba.config
;
import
org.springframework.cloud.gateway.route.RouteLocator
;
import
org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* 以配置文件的方式来配置gateway网关转发
*
* @author : qinyingjie
* @version : 2.2.0
* @date : 2023/2/17 22:59
*/
@Configuration
public
class
GatewayConfig
{
/**
* 访问外网淘宝网
*
* @param builder
* @return
*/
@Bean
public
RouteLocator
customRouteLocator
(
RouteLocatorBuilder
builder
)
{
return
builder
.
routes
()
.
route
(
"gateway_baidu"
,
r
->
r
.
path
(
"/gateway/toTaobao"
)
.
uri
(
"http://www.taobao.com"
))
.
build
();
//id,访问配置path,以及真正访问地址
}
}
nacos-server-gateway/src/main/java/com/kwan/springcloudalibaba/util/GetZonedDateTime.java
0 → 100644
浏览文件 @
0416de1a
package
com.kwan.springcloudalibaba.util
;
import
java.time.ZonedDateTime
;
public
class
GetZonedDateTime
{
public
static
void
main
(
String
[]
args
)
{
ZonedDateTime
zonedDateTime
=
ZonedDateTime
.
now
();
//输出时区时间
System
.
out
.
println
(
zonedDateTime
);
}
}
nacos-server-gateway/src/main/resources/bootstrap.yml
浏览文件 @
0416de1a
...
...
@@ -24,6 +24,7 @@ spring:
profiles
:
active
:
dev
cloud
:
#gateway网关配置
gateway
:
enabled
:
true
#开启网关
discovery
:
...
...
@@ -34,18 +35,39 @@ spring:
uri
:
lb://nacos-server-consumer
predicates
:
-
Path=/nacos/consumer/test,/nacos/consumer/index
# - After=2023-02-17T23:26:22.403+08:00[Asia/Shanghai]
# - Before=2023-02-17T23:26:22.403+08:00[Asia/Shanghai]
# - Between=2023-02-17T23:26:22.403+08:00[Asia/Shanghai],2023-03-30T16:00:22.432+08:00[Asia/shanghai]
# - Between=2023-03-17T23:26:22.403+08:00[Asia/Shanghai],2023-03-30T16:00:22.432+08:00[Asia/shanghai]
# - Cookie=username,Lisi
# - Cookie=username,\d+
# - Header=id,001
# - Header=id,\d+
# - Host=**.somehost.org,**.anotherhost.org
# - Method=GET,POST
-
Query=number,abc
# - Method=POST
-
id
:
route2
uri
:
lb://nacos-server-producer
predicates
:
-
Path=/service/**
filter
:
-
AddRequestHeader=X-Request-Id,12345
-
id
:
weight_high
uri
:
https://weighthigh.org
predicates
:
-
Weight=group1,
8
-
id
:
weight_low
uri
:
https://weightlow.org
predicates
:
-
Weight=group1,
2
#nacos配置
nacos
:
discovery
:
server-addr
:
http://120.79.36.53:8848
#服务注册地址
username
:
nacos
password
:
nacos
#sentinel配置
sentinel
:
transport
:
dashboard
:
127.0.0.1:8181
...
...
nacos-server-producer-9091/pom.xml
浏览文件 @
0416de1a
...
...
@@ -85,5 +85,9 @@
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
1.1.10
</version>
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-seata
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
nacos-server-producer-9091/src/main/java/com/kwan/springcloudalibaba/controller/UserController.java
浏览文件 @
0416de1a
...
...
@@ -28,7 +28,7 @@ public class UserController {
/**
* 通过主键查询单条数据
*
*
<p>
* http://localhost:9091/user/1
*
* @param id 主键
...
...
@@ -50,4 +50,10 @@ public class UserController {
public
User
getUserByName
(
@RequestParam
String
sex
)
{
return
userService
.
getUserByName
(
sex
);
}
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
public
Result
save
(
@RequestBody
User
user
)
{
return
Result
.
ok
(
userService
.
saveUser
(
user
));
}
}
\ No newline at end of file
nacos-server-producer-9091/src/main/java/com/kwan/springcloudalibaba/service/IUserService.java
浏览文件 @
0416de1a
...
...
@@ -29,4 +29,12 @@ public interface IUserService extends IService<User> {
* @return
*/
User
getUserByName
(
String
sex
);
/**
* 保存用户
*
* @param user
* @return
*/
User
saveUser
(
User
user
);
}
nacos-server-producer-9091/src/main/java/com/kwan/springcloudalibaba/service/impl/UserServiceImpl.java
浏览文件 @
0416de1a
...
...
@@ -34,4 +34,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
}
return
userByName
;
}
@Override
public
User
saveUser
(
User
user
)
{
userMapper
.
insert
(
user
);
// final int i = 1 / 0;
return
user
;
}
}
\ No newline at end of file
nacos-server-producer-9091/src/main/resources/bootstrap.yml
浏览文件 @
0416de1a
#端口号
server
:
port
:
9091
#spring配置
spring
:
application
:
...
...
@@ -17,4 +17,13 @@ spring:
file-extension
:
yaml
#文件类型
group
:
DEV_GROUP
#组别
namespace
:
4cd9bd32-8f25-45cd-b919-df1a0df146e0
#命名空间
refresh-enabled
:
true
#默认自动刷新
\ No newline at end of file
refresh-enabled
:
true
#默认自动刷新
seata
:
application-id
:
nacos-server-producer
tx-service-group
:
my-tx-group
service
:
vgroup-mapping
:
my-tx-group
:
seata-server
grouplist
:
seata-server
:
127.0.0.1:8091
enabled
:
true
\ No newline at end of file
nacos-server-producer-9092/pom.xml
浏览文件 @
0416de1a
...
...
@@ -85,5 +85,9 @@
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
1.1.10
</version>
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-seata
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
nacos-server-producer-9092/src/main/java/com/kwan/springcloudalibaba/controller/UserController.java
浏览文件 @
0416de1a
...
...
@@ -28,7 +28,7 @@ public class UserController {
/**
* 通过主键查询单条数据
*
*
<p>
* http://localhost:9091/user/1
*
* @param id 主键
...
...
@@ -39,7 +39,6 @@ public class UserController {
return
Result
.
ok
(
userService
.
getUserById
(
id
));
}
@RequestMapping
(
value
=
"/all"
,
method
=
RequestMethod
.
GET
)
public
List
<
User
>
addAdvertise
()
{
log
.
info
(
"测试日志={}"
,
"success"
);
...
...
@@ -50,4 +49,9 @@ public class UserController {
public
User
getUserByName
(
@RequestParam
String
sex
)
{
return
userService
.
getUserByName
(
sex
);
}
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
public
Result
save
(
@RequestBody
User
user
)
{
return
Result
.
ok
(
userService
.
saveUser
(
user
));
}
}
\ No newline at end of file
nacos-server-producer-9092/src/main/java/com/kwan/springcloudalibaba/entity/User.java
已删除
100644 → 0
浏览文件 @
c641f54f
package
com.kwan.springcloudalibaba.entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@TableName
(
value
=
"user"
)
@AllArgsConstructor
@NoArgsConstructor
public
class
User
{
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
private
String
name
;
private
String
sex
;
}
nacos-server-producer-9092/src/main/java/com/kwan/springcloudalibaba/service/IUserService.java
浏览文件 @
0416de1a
...
...
@@ -29,4 +29,13 @@ public interface IUserService extends IService<User> {
* @return
*/
User
getUserByName
(
String
sex
);
/**
* 保存用户
*
* @param user
* @return
*/
User
saveUser
(
User
user
);
}
nacos-server-producer-9092/src/main/java/com/kwan/springcloudalibaba/service/impl/UserServiceImpl.java
浏览文件 @
0416de1a
...
...
@@ -34,4 +34,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
}
return
userByName
;
}
@Override
public
User
saveUser
(
User
user
)
{
userMapper
.
insert
(
user
);
// final int i = 1 / 0;
return
user
;
}
}
\ No newline at end of file
nacos-server-producer-9092/src/main/resources/bootstrap.yml
浏览文件 @
0416de1a
#端口号
server
:
port
:
9092
#spring配置
spring
:
application
:
...
...
@@ -17,4 +17,13 @@ spring:
file-extension
:
yaml
#文件类型
group
:
DEV_GROUP
#组别
namespace
:
4cd9bd32-8f25-45cd-b919-df1a0df146e0
#命名空间
refresh-enabled
:
true
#默认自动刷新
\ No newline at end of file
refresh-enabled
:
true
#默认自动刷新
seata
:
application-id
:
nacos-server-producer
tx-service-group
:
my-tx-group
service
:
vgroup-mapping
:
my-tx-group
:
seata-server
grouplist
:
seata-server
:
127.0.0.1:8091
enabled
:
true
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录