提交 7f5038e5 authored 作者: YunaiV's avatar YunaiV

升级 Dubbo 到 2.7.1 。目前 Dubbo 引用服务存在 Bug ,所以需要使用 @Autowire 解决下。

上级 903489bc
...@@ -23,6 +23,7 @@ import io.swagger.annotations.ApiImplicitParam; ...@@ -23,6 +23,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference; import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
...@@ -33,11 +34,14 @@ import java.util.stream.Collectors; ...@@ -33,11 +34,14 @@ import java.util.stream.Collectors;
@Api("管理员模块") @Api("管理员模块")
public class AdminController { public class AdminController {
@Reference(validation = "true", lazy = true) @Reference(validation = "true")
@Autowired // TODO Dubbo 2.7.2 移除 bug
private ResourceService resourceService; private ResourceService resourceService;
@Reference(validation = "true", lazy = true) @Reference(validation = "true")
@Autowired // TODO Dubbo 2.7.2 移除 bug
private AdminService adminService; private AdminService adminService;
@Reference(validation = "true", lazy = true) @Reference(validation = "true")
@Autowired // TODO Dubbo 2.7.2 移除 bug
private RoleService roleService; private RoleService roleService;
// =========== 当前管理员相关的资源 API =========== // =========== 当前管理员相关的资源 API ===========
......
...@@ -16,6 +16,7 @@ import io.swagger.annotations.Api; ...@@ -16,6 +16,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -26,7 +27,8 @@ import java.util.List; ...@@ -26,7 +27,8 @@ import java.util.List;
@Api("数据字典模块") @Api("数据字典模块")
public class DataDictController { public class DataDictController {
@Reference(validation = "true", lazy = true) @Reference(validation = "true")
@Autowired // TODO Dubbo 2.7.2 移除 bug
private DataDictService dataDictService; private DataDictService dataDictService;
@GetMapping("/list") @GetMapping("/list")
......
...@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiImplicitParam; ...@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference; import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -20,7 +21,8 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -20,7 +21,8 @@ import org.springframework.web.bind.annotation.RestController;
@Api("Admin Passport 模块") @Api("Admin Passport 模块")
public class PassportController { public class PassportController {
@Reference(validation = "true", lazy = true) @Reference(validation = "true")
@Autowired // TODO Dubbo 2.7.2 移除 bug
private OAuth2Service oauth2Service; private OAuth2Service oauth2Service;
@PostMapping("/login") @PostMapping("/login")
......
...@@ -15,6 +15,7 @@ import io.swagger.annotations.Api; ...@@ -15,6 +15,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -28,7 +29,8 @@ import java.util.stream.Collectors; ...@@ -28,7 +29,8 @@ import java.util.stream.Collectors;
@Api("资源模块") @Api("资源模块")
public class ResourceController { public class ResourceController {
@Reference(validation = "true", lazy = true) @Reference(validation = "true")
@Autowired // TODO Dubbo 2.7.2 移除 bug
private ResourceService resourceService; private ResourceService resourceService;
@SuppressWarnings("Duplicates") @SuppressWarnings("Duplicates")
......
...@@ -20,6 +20,7 @@ import org.apache.dubbo.config.annotation.Reference; ...@@ -20,6 +20,7 @@ import org.apache.dubbo.config.annotation.Reference;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
...@@ -29,9 +30,11 @@ import java.util.stream.Collectors; ...@@ -29,9 +30,11 @@ import java.util.stream.Collectors;
@RequestMapping("admins/role") @RequestMapping("admins/role")
public class RoleController { public class RoleController {
@Reference(validation = "true", lazy = true) @Reference(validation = "true")
@Autowired // TODO Dubbo 2.7.2 移除 bug
private RoleService roleService; private RoleService roleService;
@Reference(validation = "true", lazy = true) @Reference(validation = "true")
@Autowired // TODO Dubbo 2.7.2 移除 bug
private ResourceService resourceService; private ResourceService resourceService;
@GetMapping("/page") @GetMapping("/page")
......
...@@ -8,6 +8,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils; ...@@ -8,6 +8,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.dubbo.config.annotation.Reference; import org.apache.dubbo.config.annotation.Reference;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
...@@ -32,7 +33,8 @@ public class AdminAccessLogInterceptor extends HandlerInterceptorAdapter { ...@@ -32,7 +33,8 @@ public class AdminAccessLogInterceptor extends HandlerInterceptorAdapter {
*/ */
private static final ThreadLocal<Integer> ADMIN_ID = new ThreadLocal<>(); private static final ThreadLocal<Integer> ADMIN_ID = new ThreadLocal<>();
@Reference(lazy = true) // TODO 芋艿,初始化时,会存在 spring boot 启动时,服务无法引用的情况,先暂时这么解决。 @Reference(lazy = true)
@Autowired(required = false) // TODO 芋艿,初始化时,会存在 spring boot 启动时,服务无法引用的情况,先暂时这么解决。
private AdminAccessLogService adminAccessLogService; private AdminAccessLogService adminAccessLogService;
@Override @Override
......
...@@ -9,6 +9,7 @@ import cn.iocoder.mall.admin.api.constant.AdminErrorCodeEnum; ...@@ -9,6 +9,7 @@ import cn.iocoder.mall.admin.api.constant.AdminErrorCodeEnum;
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContext; import cn.iocoder.mall.admin.sdk.context.AdminSecurityContext;
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder; import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
import org.apache.dubbo.config.annotation.Reference; import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
...@@ -22,7 +23,8 @@ import java.util.Set; ...@@ -22,7 +23,8 @@ import java.util.Set;
@Component @Component
public class AdminSecurityInterceptor extends HandlerInterceptorAdapter { public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
@Reference(lazy = true) // TODO 芋艿,初始化时,会存在 spring boot 启动时,服务无法引用的情况,先暂时这么解决。 @Reference(validation = "true")
@Autowired(required = false) // TODO 芋艿,初始化时,会存在 spring boot 启动时,服务无法引用的情况,先暂时这么解决。
private OAuth2Service oauth2Service; private OAuth2Service oauth2Service;
@Override @Override
......
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
<artifactId>product-service-impl</artifactId> <artifactId>product-service-impl</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>user-sdk</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!--<dependency>--> <!--<dependency>-->
<!--<groupId>cn.iocoder.mall</groupId>--> <!--<groupId>cn.iocoder.mall</groupId>-->
...@@ -44,34 +49,12 @@ ...@@ -44,34 +49,12 @@
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId> <artifactId>springfox-swagger2</artifactId>
...@@ -80,12 +63,7 @@ ...@@ -80,12 +63,7 @@
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>user-sdk</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
......
...@@ -18,6 +18,7 @@ import io.swagger.annotations.Api; ...@@ -18,6 +18,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
...@@ -28,6 +29,7 @@ import java.util.List; ...@@ -28,6 +29,7 @@ import java.util.List;
public class AdminsProductAttrController { public class AdminsProductAttrController {
@Reference(validation = "true") @Reference(validation = "true")
@Autowired
private ProductAttrService productAttrService; private ProductAttrService productAttrService;
@GetMapping("/attr/page") @GetMapping("/attr/page")
......
...@@ -15,6 +15,7 @@ import io.swagger.annotations.Api; ...@@ -15,6 +15,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -29,6 +30,7 @@ import java.util.stream.Collectors; ...@@ -29,6 +30,7 @@ import java.util.stream.Collectors;
public class AdminsProductCategoryController { public class AdminsProductCategoryController {
@Reference(validation = "true") @Reference(validation = "true")
@Autowired
private ProductCategoryService productCategoryService; private ProductCategoryService productCategoryService;
@GetMapping("/tree") @GetMapping("/tree")
......
...@@ -31,6 +31,7 @@ import java.util.List; ...@@ -31,6 +31,7 @@ import java.util.List;
public class AdminsProductSpuController { public class AdminsProductSpuController {
@Reference(validation = "true") @Reference(validation = "true")
@Autowired
private ProductSpuService productSpuService; private ProductSpuService productSpuService;
@Autowired @Autowired
......
...@@ -10,6 +10,7 @@ import org.apache.dubbo.config.annotation.Reference; ...@@ -10,6 +10,7 @@ import org.apache.dubbo.config.annotation.Reference;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -23,6 +24,7 @@ import java.util.List; ...@@ -23,6 +24,7 @@ import java.util.List;
public class UsersProductCategoryController { public class UsersProductCategoryController {
@Reference(validation = "true") @Reference(validation = "true")
@Autowired
private ProductCategoryService productCategoryService; private ProductCategoryService productCategoryService;
@GetMapping("/list") @GetMapping("/list")
......
...@@ -13,6 +13,7 @@ import io.swagger.annotations.Api; ...@@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
public class UsersProductSpuController { public class UsersProductSpuController {
@Reference(validation = "true") @Reference(validation = "true")
@Autowired
private ProductSpuService productSpuService; private ProductSpuService productSpuService;
@GetMapping("/info") @GetMapping("/info")
......
...@@ -36,6 +36,18 @@ ...@@ -36,6 +36,18 @@
<groupId>org.apache.dubbo</groupId> <groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId> <artifactId>dubbo</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论