引入 spring cloud dubbo 依赖,实现 dubbo + rest 双协议
This commit is contained in:
parent
13936b39aa
commit
6d9195ac83
@ -9,4 +9,6 @@ public class ApiConstants {
|
||||
|
||||
public static final String API_PREFIX = "/rpc-api/system";
|
||||
|
||||
public static final String API_VERSION = "1.0.0";
|
||||
|
||||
}
|
||||
|
@ -72,6 +72,17 @@
|
||||
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 远程调用相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 注册中心相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||
import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -16,8 +17,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.module.system.enums.ApiConstants.API_VERSION;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@DubboService(version = API_VERSION) // 提供 Dubbo RPC 接口,给 Dubbo Consumer 调用
|
||||
@Validated
|
||||
public class OAuth2TokenApiImpl implements OAuth2TokenApi {
|
||||
|
||||
|
@ -66,7 +66,17 @@ mybatis-plus:
|
||||
# id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
type-aliases-package: ${yudao.info.base-package}.module.*.dal.dataobject
|
||||
type-aliases-package: ${yudao.info.base-package}.dal.dataobject
|
||||
|
||||
--- #################### RPC 远程调用相关配置 ####################
|
||||
dubbo:
|
||||
scan:
|
||||
base-packages: ${yudao.info.base-package}.api # 指定 Dubbo 服务实现类的扫描基准包
|
||||
protocol:
|
||||
name: dubbo # 协议名称
|
||||
port: -1 # 协议端口,-1 表示自增端口,从 20880 开始
|
||||
registry:
|
||||
address: spring-cloud://localhost # 设置使用 Spring Cloud 注册中心
|
||||
|
||||
--- #################### 芋道相关配置 ####################
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user