升级 Dubbo 到 2.7.1 。目前 Dubbo 引用服务存在 Bug ,所以需要使用 @Autowire 解决下。
This commit is contained in:
@@ -36,15 +36,15 @@
|
||||
<artifactId>common-framework</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>user-sdk</artifactId>
|
||||
<artifactId>admin-sdk</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>admin-sdk</artifactId>
|
||||
<artifactId>user-sdk</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -58,20 +58,6 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.boot</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
@@ -80,13 +66,6 @@
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>admin-sdk</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package cn.iocoder.mall.user.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.application.convert.UserConvert;
|
||||
import cn.iocoder.mall.user.application.vo.admins.AdminsUserPageVO;
|
||||
import cn.iocoder.mall.user.api.dto.UserPageDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserUpdateDTO;
|
||||
import cn.iocoder.mall.user.api.UserService;
|
||||
import cn.iocoder.mall.user.api.bo.UserPageBO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import cn.iocoder.mall.user.api.dto.UserPageDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserUpdateDTO;
|
||||
import cn.iocoder.mall.user.application.convert.UserConvert;
|
||||
import cn.iocoder.mall.user.application.vo.admins.AdminsUserPageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class AdminsUserController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
@Autowired // TODO dubbo 2.7.2 删除,用于解决 bug
|
||||
private UserService userService;
|
||||
|
||||
// 分页
|
||||
@@ -66,4 +68,4 @@ public class AdminsUserController {
|
||||
return userService.updateUserStatus(id, status);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,12 @@ import cn.iocoder.mall.user.api.OAuth2Service;
|
||||
import cn.iocoder.mall.user.api.UserService;
|
||||
import cn.iocoder.mall.user.api.bo.OAuth2AccessTokenBO;
|
||||
import cn.iocoder.mall.user.application.vo.users.UsersMobileRegisterVO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -24,11 +25,14 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Api("Passport 模块")
|
||||
public class PassportController {
|
||||
|
||||
@Reference
|
||||
@Reference(validation = "true")
|
||||
@Autowired // TODO dubbo 2.7.2 删除,用于解决 bug
|
||||
private OAuth2Service oauth2Service;
|
||||
@Reference
|
||||
@Reference(validation = "true")
|
||||
@Autowired // TODO dubbo 2.7.2 删除,用于解决 bug
|
||||
private UserService userService;
|
||||
@Reference
|
||||
@Reference(validation = "true")
|
||||
@Autowired // TODO dubbo 2.7.2 删除,用于解决 bug
|
||||
private MobileCodeService mobileCodeService;
|
||||
|
||||
// TODO 功能:手机密码登陆
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package cn.iocoder.mall.user.application.controller.users;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.api.UserAddressService;
|
||||
import cn.iocoder.mall.user.api.bo.UserAddressBO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressAddDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressUpdateDTO;
|
||||
import cn.iocoder.mall.user.application.convert.UserAddressConvert;
|
||||
import cn.iocoder.mall.user.application.po.UserAddressAddPO;
|
||||
import cn.iocoder.mall.user.application.po.UserAddressUpdatePO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressAddDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressUpdateDTO;
|
||||
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
||||
import cn.iocoder.mall.user.api.UserAddressService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -25,10 +26,11 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("users/address")
|
||||
@Api(description = "用户地址API")
|
||||
@Api(value = "用户地址API")
|
||||
public class UserAddressController {
|
||||
|
||||
@Autowired
|
||||
@Reference(validation = "true")
|
||||
@Autowired // TODO dubbo 2.7.2 删除,用于解决 bug
|
||||
private UserAddressService userAddressService;
|
||||
|
||||
@PostMapping("add")
|
||||
|
||||
@@ -7,9 +7,10 @@ import cn.iocoder.mall.user.api.dto.UserUpdateDTO;
|
||||
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
||||
import cn.iocoder.mall.user.application.vo.users.UsersUserVO;
|
||||
import cn.iocoder.mall.user.api.UserService;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class UserController {
|
||||
|
||||
@Reference(validation = "true")
|
||||
@Autowired // TODO dubbo 2.7.2 删除,用于解决 bug
|
||||
private UserService userService;
|
||||
|
||||
@GetMapping("/info")
|
||||
@@ -47,4 +49,4 @@ public class UserController {
|
||||
return userService.updateUser(userUpdateDTO);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,36 +15,31 @@
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>common-framework</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>user-service-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>5.1.5.RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>5.1.5.RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>5.1.5.RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@ package cn.iocoder.mall.user.sdk.interceptor;
|
||||
import cn.iocoder.common.framework.util.HttpUtil;
|
||||
import cn.iocoder.mall.user.api.UserAccessLogService;
|
||||
import cn.iocoder.mall.user.api.dto.UserAccessLogAddDTO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
@@ -34,6 +35,7 @@ public class UserAccessLogInterceptor extends HandlerInterceptorAdapter {
|
||||
private static final ThreadLocal<Integer> USER_ID = new ThreadLocal<>();
|
||||
|
||||
@Reference
|
||||
@Autowired(required = false)
|
||||
private UserAccessLogService userAccessLogService;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,8 @@ import cn.iocoder.mall.user.api.bo.OAuth2AuthenticationBO;
|
||||
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
||||
import cn.iocoder.mall.user.sdk.context.UserSecurityContext;
|
||||
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
||||
import com.alibaba.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.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
@@ -16,7 +17,6 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
/**
|
||||
* 安全拦截器
|
||||
*/
|
||||
@@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class UserSecurityInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
@Reference
|
||||
@Autowired(required = false)
|
||||
private OAuth2Service oauth2Service;
|
||||
|
||||
@Override
|
||||
@@ -63,4 +64,4 @@ public class UserSecurityInterceptor extends HandlerInterceptorAdapter {
|
||||
UserSecurityContextHolder.clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,12 +15,10 @@
|
||||
|
||||
<artifactId>user-service-impl</artifactId>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>user-service-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -38,9 +36,21 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
</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>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.Date;
|
||||
* MobileCodeService ,实现用户登陆时需要的验证码
|
||||
*/
|
||||
@Service
|
||||
@com.alibaba.dubbo.config.annotation.Service
|
||||
@org.apache.dubbo.config.annotation.Service
|
||||
public class MobileCodeServiceImpl implements MobileCodeService {
|
||||
|
||||
/**
|
||||
@@ -107,4 +107,4 @@ public class MobileCodeServiceImpl implements MobileCodeService {
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.UUID;
|
||||
* OAuth2Service ,实现用户授权相关的逻辑
|
||||
*/
|
||||
@Service
|
||||
@com.alibaba.dubbo.config.annotation.Service
|
||||
@org.apache.dubbo.config.annotation.Service
|
||||
public class OAuth2ServiceImpl implements OAuth2Service {
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
@com.alibaba.dubbo.config.annotation.Service(validation = "true")
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
||||
public class UserAccessLogServiceImpl implements UserAccessLogService {
|
||||
|
||||
/**
|
||||
@@ -53,4 +53,4 @@ public class UserAccessLogServiceImpl implements UserAccessLogService {
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
* @time 2019-04-06 13:26
|
||||
*/
|
||||
@Service
|
||||
@com.alibaba.dubbo.config.annotation.Service(validation = "true")
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
||||
public class UserAddressServiceImpl implements UserAddressService {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -5,10 +5,6 @@ import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.util.ValidationUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.biz.dao.UserMapper;
|
||||
import cn.iocoder.mall.user.biz.dao.UserRegisterMapper;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserDO;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserRegisterDO;
|
||||
import cn.iocoder.mall.user.api.UserService;
|
||||
import cn.iocoder.mall.user.api.bo.UserBO;
|
||||
import cn.iocoder.mall.user.api.bo.UserPageBO;
|
||||
@@ -17,7 +13,12 @@ import cn.iocoder.mall.user.api.constant.UserErrorCodeEnum;
|
||||
import cn.iocoder.mall.user.api.dto.UserPageDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserUpdateDTO;
|
||||
import cn.iocoder.mall.user.biz.convert.UserConvert;
|
||||
import cn.iocoder.mall.user.biz.dao.UserMapper;
|
||||
import cn.iocoder.mall.user.biz.dao.UserRegisterMapper;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserDO;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserRegisterDO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -25,8 +26,8 @@ import java.util.Date;
|
||||
/**
|
||||
* UserService ,实现和用户信息相关的逻辑
|
||||
*/
|
||||
@org.springframework.stereotype.Service
|
||||
@com.alibaba.dubbo.config.annotation.Service
|
||||
@Service
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Autowired
|
||||
@@ -148,4 +149,4 @@ public class UserServiceImpl implements UserService {
|
||||
|| UserConstants.STATUS_DISABLE.equals(status);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user